public ActionResult Edit(GalleryCreate galleryView) { var galleryModel = Mapper.Map <GalleryModelWithoutImage>(galleryView); galleryModel.UserId = User.Identity.GetUserId(); ServicesHost.GetService <IGalleryService>().Edit(galleryModel); return(RedirectToAction("Index")); }
public ActionResult Create(GalleryCreate gallery) { if (!ModelState.IsValid) return View(gallery); IGalleryDAC dac = new GalleryDAC(); dac.Add(gallery.Name, gallery.Description, gallery.SortOrder); return RedirectToAction("Index"); }
public ActionResult Create(GalleryCreate gallery) { if (!ModelState.IsValid) { return(View(gallery)); } IGalleryDAC dac = new GalleryDAC(); dac.Add(gallery.Name, gallery.Description, gallery.SortOrder); return(RedirectToAction("Index")); }
public ActionResult Create(GalleryCreate galleryView) { try { if (ModelState.IsValid) { galleryView.UserId = User.Identity.GetUserId(); var galleryModel = Mapper.Map <GalleryModelWithoutImage>(galleryView); ServicesHost.GetService <IGalleryService>().Create(galleryModel); return(RedirectToAction("Index")); } else { return(View(galleryView)); } } catch (Exception e) { ViewBag.StateCreate = e.Message; return(View(galleryView)); } }