public ActionResult Delete(int?genreId) { GenreItemModel genreItemModel = new GenreItemModel() { IsSecurityOperations = this.IsSecurityOperations, Genre = new GenreViewModel(), ControllerAction = "Delete" }; try { if (IsDelete(genreItemModel.OperationResult)) { Genre genre = Repository.GetById(new object[] { genreId }); if (genre != null) { genreItemModel.Genre = new GenreViewModel(genre); } } } catch (Exception exception) { genreItemModel.OperationResult.ParseException(exception); } return(PartialView(genreItemModel)); }
public ActionResult Update(GenreItemModel genreItemModel) { try { if (IsUpdate(genreItemModel.OperationResult)) { if (ValidateModelState(Repository)) { if (Repository.Update(genreItemModel.OperationResult, (Genre)genreItemModel.Genre.ToData())) { if (UnitOfWork.Save(genreItemModel.OperationResult)) { return(JsonResultSuccess(new { uri = ReadUrlDictionary() })); } } } } } catch (Exception exception) { genreItemModel.OperationResult.ParseException(exception); } return(JsonResultOperationResult(genreItemModel.OperationResult)); }
public ActionResult Update(GenreItemModel genreItemModel) { try { if (IsUpdate(genreItemModel.OperationResult)) { if (ValidateModelState(Repository)) { if (Repository.Update(genreItemModel.OperationResult, (Genre)genreItemModel.Genre.ToData())) { if (UnitOfWork.Save(genreItemModel.OperationResult)) { return(RedirectToUrlDictionary()); } } } } } catch (Exception exception) { genreItemModel.OperationResult.ParseException(exception); } genreItemModel.IsSecurityOperations = IsSecurityOperations; return(View(genreItemModel)); }
public ActionResult Create() { GenreItemModel genreItemModel = new GenreItemModel() { IsSecurityOperations = this.IsSecurityOperations, Genre = new GenreViewModel(), ControllerAction = "Create" }; try { IsCreate(genreItemModel.OperationResult); } catch (Exception exception) { genreItemModel.OperationResult.ParseException(exception); } return(PartialView(genreItemModel)); }