public static void EditInformationCompoun(Compoun compoun, Compoun SelectedItem, Doctor doctor, Patient patient) { UnitOfWork unitOfWork = new UnitOfWork(); unitOfWork.Compouns.Update(compoun); unitOfWork.Save(); compoun.Doctor = doctor; compoun.Patient = patient; var item = Admin_CompounsViewModel.Compouns.FirstOrDefault(x => x.Id == compoun.Id); Admin_CompounsViewModel.Compouns[Admin_CompounsViewModel.Compouns.IndexOf(SelectedItem)] = compoun; }
public static void OrderCompoun(Doctor doctor, Compoun compoun) { UnitOfWork unitOfWork = new UnitOfWork(); var orderExist = unitOfWork.Compouns.GetAll().ToList().FindAll(x => x.TimeOfReception == compoun.TimeOfReception && x.IsOrder == true && x.DateOfReception == compoun.DateOfReception && x.DoctorId == doctor.Id); if (orderExist == null || orderExist.Count == 0) { unitOfWork.Compouns.Create(compoun); unitOfWork.Save(); MessageBox.Show("Успешно добавлено"); compoun.Doctor = doctor; PatientProfileViewModel.Compouns.Add(compoun); } else { MessageBox.Show("Талонов на это время уже нет"); } }