с какого то хера не считается сумма
This commit is contained in:
parent
58cc5f1286
commit
e8cc602897
@ -18,7 +18,7 @@ namespace VeterinaryRestApi.Controllers
|
||||
_logger = logger;
|
||||
_drug = drug;
|
||||
}
|
||||
|
||||
// naher ya eto pisal
|
||||
[HttpGet]
|
||||
public Tuple<DrugViewModel, List<string>>? GetDrug(int drugId)
|
||||
{
|
||||
@ -35,6 +35,23 @@ namespace VeterinaryRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public DrugViewModel? GetOneDrug(int drugId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _drug.ReadElement(new DrugSearchModel
|
||||
{
|
||||
Id =drugId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения продукта по id={Id}",drugId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<DrugViewModel> GetDrugs(int doctorId)
|
||||
{
|
||||
|
@ -334,8 +334,8 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets");
|
||||
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getdrugs");
|
||||
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}");
|
||||
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getalldrugs");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -366,7 +366,7 @@ namespace VeterinaryShowOwnerApp.Controllers
|
||||
[HttpPost]
|
||||
public double Calc(int count, int drug)
|
||||
{
|
||||
var dru = APIOwner.GetRequest<DrugViewModel>($"api/drug/getdrugs?drugId={drug}");
|
||||
var dru = APIOwner.GetRequest<DrugViewModel>($"api/drug/getonedrug?drugId={drug}");
|
||||
return count * (dru?.Price ?? 1);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<select id="purchases" name="purchases" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases, "Id"))">
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
@ -71,7 +70,6 @@
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</select>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user