public ActionResult Edit( Gallery model, int Id) { if (!ModelState.IsValid) return View(model); _repository.UpdateGallery(model.Name, model.Description, Id); return RedirectToAction("Index"); }
public GalleryDetailsModel(Gallery gallery, int pageNumber, int pageSize) { Id = gallery.Id; Name = gallery.Name; Description = gallery.Description; Photos = gallery.Photos.OrderBy(photo => photo.UploadDateTime).ToPagedList(pageNumber, pageSize); }
public ActionResult Create(Gallery gallery, HttpPostedFileBase photo) { if (!ModelState.IsValid) return View(gallery); gallery.CoverPhotoPath = SavePhotoService.UploadPhoto(photo); gallery = _repository.Insert(gallery); return RedirectToAction("Details", new{gallery.Id}); }