public void updatePrescription(prescription modified) { prescription currentPres = hms.prescriptions.Where(x => x.prid == modified.prid).FirstOrDefault(); hms.Entry(currentPres).CurrentValues.SetValues(modified); hms.SaveChanges(); }
public void AddPrescriptionToBill_NoneExistsBillId_ThrowArgumentOutOfRangeException() { prescription validPrescription = new prescription(); int NoneExistsBillId = -1; Action act = () => _sut.AddPrescriptionToBill(NoneExistsBillId, validPrescription); act.Should().Throw <ArgumentOutOfRangeException>() .WithMessage("Bill Khong Ton Tai\nParameter name: billId"); }
public void AddPrescriptionToBill(int billId, prescription prescription) { var bill = GetUnpaidBillById(billId); if (bill is null) { throw new ArgumentOutOfRangeException("billId", "Bill Khong Ton Tai"); } bill.prescriptions.Add(prescription); Save(); }
public ActionResult DeleteConfirmed(Guid id) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } prescription prescription = db.prescriptions.Find(id); Guid visitId = (Guid)prescription.visitId; db.prescriptions.Remove(prescription); db.SaveChanges(); return(RedirectToAction("Index", new { @id = visitId })); }
private MedicineAssignedVM GetMedicineViewModel(prescription prescriptionItem) { medicine med = _medicineRepository.GetMedicineById(prescriptionItem.medicine_id); return(new MedicineAssignedVM() { Name = med.medicine_name, Description = prescriptionItem.description, Quantity = prescriptionItem.quantity_indicated.ToString(), SalePrice = med.sale_price_per_unit.ToString(), Unit = med.sale_unit }); }
public ActionResult Edit([Bind(Include = "id,notes,visitId")] prescription prescription) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (ModelState.IsValid) { db.Entry(prescription).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { id = prescription.visitId })); } return(View(prescription)); }
private prescription AddMedicineToPrescription(int billId, int medicineId) { prescription prescription = new prescription() { bill_id = billId, medicine_id = medicineId, date_created = DateTime.Now, quantity_indicated = _view.Quantity, description = _view.Descriptions, staff_id = Program.staffId }; return(prescription); }
public void AddPrescriptionToBill_ExistsBillIdAndValidService_AddToUnpaidListSuccessfully() { int existsBillId = 1; var validPrescription = new prescription() { bill_id = existsBillId, date_created = _timeMock.Object.UtcNow, description = "Ngay 3 lan", medicine_id = 1, quantity_indicated = 10, staff_id = 1 }; _sut.AddPrescriptionToBill(existsBillId, validPrescription); _sut.GetListUnpaidBill()[0].prescriptions.Should().Contain(validPrescription); }
// GET: prescriptions/Edit/5 public ActionResult Edit(Guid?id) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } prescription prescription = db.prescriptions.Find(id); if (prescription == null) { return(HttpNotFound()); } return(View(prescription)); }
// GET: medicines/Create public ActionResult Create(Guid?id) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (id == null || id == Guid.Empty) { return(HttpNotFound()); } prescription presc = db.prescriptions.FirstOrDefault(i => i.id == id); if (presc == null) { return(HttpNotFound()); } ViewBag.prescription = presc; return(View()); }
// GET: medicines public ActionResult Index(Guid?id) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (id == null || id == Guid.Empty) { return(HttpNotFound()); } prescription presc = db.prescriptions.FirstOrDefault(i => i.id == id); if (presc == null) { return(HttpNotFound()); } ViewBag.prescription = presc; ViewBag.visit = presc.visit; return(View(db.medicines.Where(o => o.prescriptionId == id).ToList())); }
public ActionResult Create(medicine medicine) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (ModelState.IsValid) { medicine.id = Guid.NewGuid(); db.medicines.Add(medicine); db.SaveChanges(); return(RedirectToAction("Index", new { @id = medicine.prescriptionId })); } prescription presc = db.prescriptions.FirstOrDefault(i => i.id == medicine.prescriptionId); if (presc == null) { return(HttpNotFound()); } ViewBag.prescription = presc; return(View(medicine)); }
public ActionResult Create([Bind(Include = "id,notes,visitId")] prescription prescription) { if (!HomeController.Authorized(this)) { return(RedirectToAction("Login", "Accounts")); } if (ModelState.IsValid) { prescription.id = Guid.NewGuid(); db.prescriptions.Add(prescription); db.SaveChanges(); return(RedirectToAction("Index", new { @id = prescription.visitId })); } visit visit = _visitService.get(prescription.visitId); if (visit == null) { return(HttpNotFound()); } ViewBag.visit = visit; return(View(prescription)); }
public void AddPrescriptionToDatabase(prescription prescription) { _medicineRepository.DecreaseQuantity(prescription.medicine_id, prescription.quantity_indicated); _clinicEntities.prescriptions.Add(prescription); }
public void addPrescription(prescription p) { hms.prescriptions.Add(p); hms.SaveChanges(); }