public void Linking(SymptomaticLinkingBindingModel model) { var symptomatic = _symptomaticStorage.GetElement(new SymptomaticsBindingModel { Id = model.SymptomaticId }); var receipt = _receiptStorage.GetElement(new ReceiptBindingModel { Id = model.ReceiptId }); if (symptomatic == null) { throw new Exception("Не найдена выдача"); } if (receipt == null) { throw new Exception("Не найдено выписка"); } _symptomaticStorage.Update(new SymptomaticsBindingModel { Id = symptomatic.Id, IssueDate = symptomatic.IssueDate, Lungs = symptomatic.Lungs, Liver = symptomatic.Liver, Heart = symptomatic.Heart, SymptomName = symptomatic.SymptomName, SymptomaticDiseases = symptomatic.SymptomaticDiseases, DoctorId = symptomatic.DoctorId, ReceiptId = model.ReceiptId }); _receiptStorage.Update(new ReceiptBindingModel { Id = receipt.Id, Dose = receipt.Dose, PerDose = receipt.PerDose, SymptomaticsId = model.SymptomaticId, MedicineId = receipt.MedicineId }); }
public void CreateOrUpdate(ReceiptBindingModel model) { var element = _receiptStorage.GetElement(new ReceiptBindingModel { PurchaseDate = model.PurchaseDate }); if (element != null && element.Id != model.Id) { throw new Exception("Уже пробит чек в данное время"); } if (model.Id.HasValue) { _receiptStorage.Update(model); } else { _receiptStorage.Insert(model); } }
public void CreateOrUpdate(ReceiptBindingModel model) { var element = _receiptStorage.GetElement(new ReceiptBindingModel { Id = model.Id }); if (element != null && element.Id != model.Id) { throw new Exception("Уже есть выписка с таким названием"); } if (model.Id.HasValue) { _receiptStorage.Update(model); } else { _receiptStorage.Insert(model); } }