public ActionResult DeletePhoto(int id) { try { _photoService.DeleteOne(id); return(Json(MyAjaxHelper.GetSuccessResponse())); } catch (Exception exception) { Log.RegisterError(exception); return(Json(MyAjaxHelper.GetErrorResponse(exception.Message))); } }
public JsonResult ChangeOrder(PhotoSortModel model) { try { _photoService.ChangeOrder(model); return(Json(MyAjaxHelper.GetSuccessResponse())); } catch (Exception exception) { Log.RegisterError(exception); return(Json(MyAjaxHelper.GetErrorResponse(exception.Message))); } }
public JsonResult EditPhoto(PhotoUploadModel model) { try { HttpPostedFileBase file = null; if (Request?.Files.Count > 0) { file = Request.Files[0]; } _photoService.UpdateOne(model, file, _imageProcessor); return(Json(MyAjaxHelper.GetSuccessResponse())); } catch (Exception exception) { Log.RegisterError(exception); return(Json(MyAjaxHelper.GetErrorResponse(exception.Message))); } }
public ActionResult DeleteUploadPhoto(int id) { try { var model = Session["Uploads"] as PhotoUploadListModel; var photo = model.Uploads.Single(x => x.Id == id); System.IO.File.Delete(Server.MapPath(photo.PhotoPath)); System.IO.File.Delete(Server.MapPath(photo.ThumbnailPath)); model.Uploads.Remove(photo); return(Json(MyAjaxHelper.GetSuccessResponse())); } catch (Exception exception) { Log.RegisterError(exception); return(Json(MyAjaxHelper.GetErrorResponse(exception.Message))); } }
public JsonResult SetAlbumCover(int id, string cover) { try { var album = _albumService.GetOne(id); if (album != null) { album.CoverPath = cover; } _albumService.UpdateOne(album); return(Json(MyAjaxHelper.GetSuccessResponse())); } catch (Exception exception) { Log.RegisterError(exception); return(Json(MyAjaxHelper.GetErrorResponse(exception.Message))); } }