public ActionResult Edit(int id, EditionViewModel model) { Editions edition = new Editions(); edition.InjectFrom(model); var editionToUpdate = editionService.UpdateEdition(edition); return(RedirectToAction(nameof(Index))); }
public ActionResult Edit(int id, EditionViewModel model) { Editions edit = new Editions(); edit.InjectFrom(model); var createNewEdition = edition.Update(edit); return(RedirectToAction(nameof(Index))); }
public ActionResult Create(EditionViewModel model) { if (ModelState.IsValid) { Editions newEdition = new Editions(); newEdition.InjectFrom(model); var createEdition = edition.CreateEdition(newEdition); if (createEdition == null) { ModelState.AddModelError("CompanyName", "Must be unique"); return(View(model)); } } return(RedirectToAction(nameof(Index))); }
public ActionResult Edit(int id, EditionViewModel model) { if (ModelState.IsValid) { Editions editionToUpdate = new Editions(); editionToUpdate.InjectFrom(model); var createNewEdition = editions.Update(editionToUpdate); return(RedirectToAction(nameof(Index))); } else { return(View(model)); } }
public ActionResult Create(EditionViewModel model) { if (ModelState.IsValid) { Editions edition = new Editions(); edition.InjectFrom(model); var createNewEdition = editionService.AddEdition(edition); if (createNewEdition == null) { ModelState.AddModelError("Name", "The Name must be unique!"); return(View(model)); } } return(RedirectToAction(nameof(Index))); }
public ActionResult Edit(int id, EditionViewModel model) { if (ModelState.IsValid) { Editions editionToUpdate = new Editions(); editionToUpdate.InjectFrom(model); var createNewEdition = editions.Update(editionToUpdate); if (createNewEdition == null) { ModelState.AddModelError("Name", "The Name must be unique!"); return(View(model)); } return(RedirectToAction(nameof(Index))); } else { return(View(model)); } }