первый отчет работает

This commit is contained in:
antoc0der 2024-05-26 22:29:54 +04:00
parent 0964f598b9
commit 7541ee815e
4 changed files with 12 additions and 10 deletions

View File

@ -96,7 +96,7 @@ namespace VeterinaryDatabaseImplement.Implements
{
MedicationName = medication.MedicationName,
Purchases = context.Purchases.Include(purchase => purchase.Drug).ThenInclude(drug => drug.Medications)
.Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Select(x => x.MedicationId).ToList().Contains(medication.Id))
.Where(purchase => purchase.Drug != null && purchase.Drug.Medications.Any(m => m.MedicationId == medication.Id))
.Select(purchase => purchase.GetViewModel).ToList()
}).ToList();
}

View File

@ -41,10 +41,12 @@ namespace VeterinaryRestApi.Controllers
{
try
{
return _drug.ReadElement(new DrugSearchModel
{
Id =drugId
});
var elem = _drug.ReadElement(new DrugSearchModel{Id =drugId});
if (elem == null)
return null;
elem.DrugMedications = null!;
return elem;
}
catch (Exception ex)
{

View File

@ -498,7 +498,7 @@ namespace VeterinaryShowDoctorApp.Controllers
APIDoctor.PostRequest("api/report/createpurchaselistwordfile", new ReportPurchaseMedicationBindingModel
{
Medications = medications,
FileName = "C:\\ReportsCourseWork\\wordfile.docx"
FileName = "C:\\Users\\1\\Downloads\\wordfile.docx"
});
Response.Redirect("GetWordFile");
}
@ -507,7 +507,7 @@ namespace VeterinaryShowDoctorApp.Controllers
APIDoctor.PostRequest("api/report/createpurchaselistexcelfile", new ReportPurchaseMedicationBindingModel
{
Medications = medications,
FileName = "C:\\ReportsCourseWork\\excelfile.xlsx"
FileName = "C:\\Users\\1\\Downloads\\excelfile.xlsx"
});
Response.Redirect("GetExcelFile");
}
@ -516,12 +516,12 @@ namespace VeterinaryShowDoctorApp.Controllers
[HttpGet]
public IActionResult GetWordFile()
{
return new PhysicalFileResult("C:\\ReportsCourseWork\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
}
public IActionResult GetExcelFile()
{
return new PhysicalFileResult("C:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
return new PhysicalFileResult("C:\\Users\\1\\Downloads\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
}
[HttpGet]
public IActionResult Report()

View File

@ -342,7 +342,7 @@ namespace VeterinaryShowOwnerApp.Controllers
return Redirect("~/Home/Enter");
}
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}");
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getalldrugs");
ViewBag.Drugs = APIOwner.GetRequest<List<DrugViewModel>>($"api/drug/getdrugs?doctorid={null}");
return View();
}
[HttpPost]