с таким тз это все

This commit is contained in:
frog24 2024-05-29 14:43:02 +04:00
parent 1684e57bcc
commit 852dea96b4
6 changed files with 19 additions and 13 deletions

View File

@ -172,7 +172,8 @@ namespace ClientApp.Controllers
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<DoctorVisitViewModel>>($"api/doctorvisit/getvisits?clientid={APIClient.Client.Id}"));
var helpme = APIClient.GetRequest<List<DoctorVisitViewModel>>($"api/doctorvisit/getvisits?clientid={APIClient.Client.Id}");
return View(helpme);
}
public IActionResult CreateDoctorVisit()
{

View File

@ -34,14 +34,19 @@ namespace VetclinicDatabaseImplement.Implements
public List<DoctorVisitViewModel> GetFilteredList(DoctorVisitSearchModel model)
{
if (!model.Id.HasValue)
{
return new();
}
using var context = new VetclinicDatabase();
return context.DoctorVisits.Where(x => x.Id == model.Id)
.Include(x => x.Client).Include(x => x.Service).Include(x => x.Animals).ThenInclude(x => x.Animal)
.Select(x => x.GetViewModel).ToList();
if (model.DateVisit == null && model.VisitName == null && model.ServiceId == null && model.Id == null && model.ClientId != null)
{
return context.DoctorVisits.Where(x => x.ClientId == model.ClientId).Include(x => x.Client).Include(x => x.Animals).ThenInclude(x => x.Animal).Include(x => x.Service)
.Select(x => x.GetViewModel)
.ToList();
}
return context.DoctorVisits.Where(x => x.ClientId == model.ClientId).Include(x => x.Client).Include(x => x.Animals).ThenInclude(x => x.Animal).Include(x => x.Service)
.Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&
(!model.ClientId.HasValue || x.ClientId <= model.ClientId) &&
(!model.ServiceId.HasValue || x.ServiceId == model.ServiceId)))
.Select(x => x.GetViewModel)
.ToList();
}
public List<DoctorVisitViewModel> GetFullList()
{

View File

@ -12,8 +12,8 @@ using VetclinicDatabaseImplement;
namespace VetclinicDatabaseImplement.Migrations
{
[DbContext(typeof(VetclinicDatabase))]
[Migration("20240529004732_hope3")]
partial class hope3
[Migration("20240529103650_hope4")]
partial class hope4
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace VetclinicDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class hope3 : Migration
public partial class hope4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@ -68,7 +68,7 @@ namespace VetclinicDatabaseImplement.Models
Cost = Cost,
ClientId = ClientId,
ServiceName = Service?.ServiceName ?? string.Empty,
VisitAnimals = VisitAnimals
// VisitAnimals = VisitAnimals
};
public void Update(DoctorVisitBindingModel model)

View File

@ -38,7 +38,7 @@ namespace VetclinicRestApi.Controllers
}
}
[HttpGet]
public List<DoctorVisitViewModel>? GetVisits(int? clientId = null)
public List<DoctorVisitViewModel>? GetVisits(int? clientId)
{
try
{