Beispiel #1
0
        // GET: SponsorType/Details/5
        public ActionResult Details(int id)
        {
            SponsorTypes         sponsorTypes = sponsorTypeService.GetSponsorTypeById(id);
            SponsorTypeViewModel model        = new SponsorTypeViewModel();

            model.InjectFrom(sponsorTypes);
            return(View(sponsorTypes));
        }
Beispiel #2
0
        // GET: SponsorType/Delete/5
        public ActionResult Delete(int id)
        {
            var sponsorTypeToDelete    = sponsorTypeService.GetSponsorTypeById(id);
            SponsorTypeViewModel model = new SponsorTypeViewModel();

            model.InjectFrom(sponsorTypeToDelete);
            return(View(model));
        }
Beispiel #3
0
        public ActionResult Edit(int id, SponsorTypeViewModel model)
        {
            SponsorTypes sponsorTypes = new SponsorTypes();

            sponsorTypes.InjectFrom(model);
            var sponsorTypesToUpdate = sponsorTypeService.UpdateSponsorType(sponsorTypes);

            return(RedirectToAction(nameof(Index)));
        }
Beispiel #4
0
        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)));
        }
Beispiel #5
0
 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)));
 }