public ActionResult Create(DosageModel dosageModel) { if (this.DosageRepository.CreateDoseIfValid(dosageModel, ModelState.IsValid)) { return RedirectToAction("Index"); } ViewBag.UnitOfMeasurementID = new SelectList(this.DataContext.UnitsOfMeasurement, "UnitOfMeasurementID", "Name", dosageModel.UnitOfMeasurementID); return View(dosageModel); }
public ActionResult Edit(DosageModel dosageModel) { if (this.DosageRepository.UpdateDoseIfValid(dosageModel, ModelState.IsValid)) { return RedirectToAction("Index"); } //if (ModelState.IsValid) //{ // DB.Entry(dosagemodel).State = EntityState.Modified; // DB.SaveChanges(); // return RedirectToAction("Index"); //} ViewBag.UnitOfMeasurements = new SelectList(this.DataContext.UnitsOfMeasurement, "UnitOfMeasurementID", "Name", dosageModel.UnitOfMeasurementID); return View(dosageModel); }
public ActionResult Create() { var dosageModel = new DosageModel(); ViewBag.UnitOfMeasurementID = new SelectList(this.DataContext.UnitsOfMeasurement, "UnitOfMeasurementID", "Name", dosageModel.UnitOfMeasurementID); return View(); }