public ActionResult Save(pharmacy invoice) { if (!ModelState.IsValid) { var viewModel = new PharmacyFormViewModel { Pharmacy = invoice }; return(View("PharmacyForm", viewModel)); } if (invoice._Id == Guid.Empty) { _context.InsertRecord(_table, invoice); } else { var invoiceInDb = _context.LoadRecordByIdProperity <pharmacy>(_table, invoice.Id); invoiceInDb.Patient = invoice.Patient; invoiceInDb.Notes = invoice.Notes; invoiceInDb.Price = invoice.Price; invoiceInDb.Drugs = invoice.Drugs; _context.UPsertRecordByObjectId(_table, invoice._Id, invoice); } return(RedirectToAction("Index", "Pharmacy")); }
public ActionResult Index(string massage) { var viewModel = new PharmacyFormViewModel { Pharmacies = _context.Pharmacies.Where(p => p.IsApproved), Massage = massage }; return(View(User.IsInRole(UserRoles.CanApproveAndDeleteRecord) ? "PharmacyList" : "PharmacyListReadOnly", viewModel)); }
public ActionResult New() { var drug = new pharmacy(); drug.Id = GenerateUniqueID(); var viewModel = new PharmacyFormViewModel { Pharmacy = drug }; return(View("PharmacyForm", viewModel)); }
public ActionResult Edit(string id) { var drug = _context.LoadRecordByIdProperity <pharmacy>(_table, id); if (drug == null) { return(HttpNotFound()); } var viewModel = new PharmacyFormViewModel { Pharmacy = drug }; return(View("PharmacyForm", viewModel)); }