public IActionResult EditPhoto(int id) { var photo = this._photoFileProcessor.PhotoService.GetPhotoById(id); if (photo != null) { var model = new PhotosEditPhotoVM(); model.Id = photo.Id; model.Title = photo.Title; model.PhotoPath = photo.Path; return(View(model)); } return(RedirectToAction("ErrorNotFound", "Error")); }
public IActionResult EditPhoto(PhotosEditPhotoVM vm) { if (ModelState.IsValid) { var updatePhoto = new Photo(); updatePhoto.Id = vm.Id; updatePhoto.Title = vm.Title; if (this._photoFileProcessor.PhotoService.EditPhoto(updatePhoto)) { return(RedirectToAction("ViewPhoto", new { id = updatePhoto.Id })); } } return(View(vm)); }