дебаг в процессе
This commit is contained in:
parent
201a18f9bf
commit
f1f97916a8
@ -9,7 +9,7 @@ namespace VeterinaryContracts.SearchModels
|
||||
public class MedicationSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? MedicationName { get; set; }
|
||||
public string? MedicationName { get; set; } = string.Empty;
|
||||
public int? DoctorId { get; set; }
|
||||
public double? Price { get; set; }
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace VeterinaryDatabaseImplement.Implements
|
||||
return new();
|
||||
}
|
||||
using var context = new VeterinaryDatabase();
|
||||
return context.Pets
|
||||
return context.Pets.Where(x => x.OwnerId == model.OwnerId)
|
||||
.Where(x => x.PetName.Contains(model.PetName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
@ -12,7 +12,7 @@ using VeterinaryDatabaseImplement;
|
||||
namespace VeterinaryDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(VeterinaryDatabase))]
|
||||
[Migration("20240501084519_InitialCreate")]
|
||||
[Migration("20240523163748_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -61,6 +61,9 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DrugName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -194,7 +197,8 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateImplement")
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DrugId")
|
||||
@ -203,9 +207,6 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
@ -302,16 +303,12 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<DateTime>("DateVisit")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int?>("DoctorId")
|
||||
.IsRequired()
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("VisitName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -378,11 +375,13 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
|
||||
{
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", null)
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
|
||||
.WithMany("Pets")
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
|
||||
@ -431,13 +430,15 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", null)
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Services")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Doctor");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
|
@ -34,7 +34,8 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DrugName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
DoctorId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -110,7 +111,6 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
DrugId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
@ -140,7 +140,6 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
OwnerId = table.Column<int>(type: "int", nullable: false),
|
||||
DoctorId = table.Column<int>(type: "int", nullable: false),
|
||||
VisitName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateVisit = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
@ -58,6 +58,9 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DrugName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -191,7 +194,8 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateImplement")
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DrugId")
|
||||
@ -200,9 +204,6 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
@ -299,16 +300,12 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
b.Property<DateTime>("DateVisit")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int?>("DoctorId")
|
||||
.IsRequired()
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("VisitName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -375,11 +372,13 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
|
||||
{
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", null)
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
|
||||
.WithMany("Pets")
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Owner");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
|
||||
@ -428,13 +427,15 @@ namespace VeterinaryDatabaseImplement.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", null)
|
||||
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
|
||||
.WithMany("Services")
|
||||
.HasForeignKey("VisitId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Doctor");
|
||||
|
||||
b.Navigation("Visit");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
|
||||
|
@ -65,7 +65,8 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
PetName = model.PetName,
|
||||
PetType = model.PetType,
|
||||
PetBreed = model.PetBreed,
|
||||
PetGender = model.PetGender
|
||||
PetGender = model.PetGender,
|
||||
OwnerId = model.OwnerId,
|
||||
};
|
||||
}
|
||||
public void Update(PetBindingModel model)
|
||||
@ -85,7 +86,8 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
PetName = PetName,
|
||||
PetType = PetType,
|
||||
PetBreed = PetBreed,
|
||||
PetGender = PetGender
|
||||
PetGender = PetGender,
|
||||
OwnerId = OwnerId,
|
||||
};
|
||||
public void UpdateVisits(VeterinaryDatabase context, PetBindingModel model)
|
||||
{
|
||||
|
@ -222,6 +222,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
Dictionary<int, IMedicationModel> a = new Dictionary<int, IMedicationModel>();
|
||||
foreach (int medication in medications)
|
||||
{
|
||||
// фигачит нулл в значение
|
||||
a.Add(medication, new MedicationSearchModel { Id = medication } as IMedicationModel);
|
||||
}
|
||||
APIDoctor.PostRequest("api/drug/createdrug", new DrugBindingModel
|
||||
@ -333,7 +334,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Medications = APIDoctor.GetRequest<List<MedicationViewModel>>($"api/medication/getmedications");
|
||||
ViewBag.Medications = APIDoctor.GetRequest<List<MedicationViewModel>>($"api/medication/getmedications?doctorid={APIDoctor.Doctor.Id}");
|
||||
ViewBag.Visits = APIDoctor.GetRequest<List<VisitViewModel>>($"api/visit/getallvisits");
|
||||
|
||||
return View();
|
||||
|
Loading…
Reference in New Issue
Block a user