// GET: SponsorType/Details/5 public ActionResult Details(int id) { SponsorTypes sponsorTypes = sponsorTypeService.GetSponsorTypeById(id); SponsorTypeViewModel model = new SponsorTypeViewModel(); model.InjectFrom(sponsorTypes); return(View(sponsorTypes)); }
// GET: SponsorType/Delete/5 public ActionResult Delete(int id) { var sponsorTypeToDelete = sponsorTypeService.GetSponsorTypeById(id); SponsorTypeViewModel model = new SponsorTypeViewModel(); model.InjectFrom(sponsorTypeToDelete); return(View(model)); }
public ActionResult Edit(int id, SponsorTypeViewModel model) { SponsorTypes sponsorTypes = new SponsorTypes(); sponsorTypes.InjectFrom(model); var sponsorTypesToUpdate = sponsorTypeService.UpdateSponsorType(sponsorTypes); return(RedirectToAction(nameof(Index))); }
public ActionResult Delete(int id, SponsorTypeViewModel model) { SponsorTypes sponsorTypeToDelete = new SponsorTypes(); sponsorTypeToDelete = sponsorTypeService.GetSponsorTypeById(id); model.InjectFrom(sponsorTypeToDelete); sponsorTypeService.Delete(sponsorTypeToDelete); sponsorTypeService.Save(); return(RedirectToAction(nameof(Index))); }
public ActionResult Create(SponsorTypeViewModel model) { if (ModelState.IsValid) { SponsorTypes sponsorTypes = new SponsorTypes(); sponsorTypes.InjectFrom(model); var createNewSponsorType = sponsorTypeService.AddSponsorType(sponsorTypes); if (createNewSponsorType == null) { ModelState.AddModelError("Name", "The Name must be unique!"); return(View(model)); } } return(RedirectToAction(nameof(Index))); }