示例#1
0
 public ActionResult Edit(GallaryViewModel model)
 {
     if (ModelState.IsValid)
     {
         var gallary = mapper.Map <tblGallary>(model);
         gallaryService.Update(gallary);
         return(RedirectToAction("Index"));
     }
     return(Edit(model.Id));
 }
示例#2
0
        public ActionResult Create(GallaryViewModel model, HttpPostedFileBase imageFile)
        {
            if (ModelState.IsValid)
            {
                var gallary = mapper.Map <tblGallary>(model);
                gallary.ImageLink = SaveImage(imageFile);
                gallaryService.AddGallary(gallary);

                return(RedirectToAction("Index"));
            }
            return(Create());
        }