public ActionResult DeleteClassificationPost(int id) { AuthorizeAndRedirect(); ClassificationValidation validation = _Manager.DeleteClassification(_Manager.GetClassificationFromID(id)); if (validation.IsValid) { return(RedirectToAction("BrowseAllBooks", "Book", null)); } ValidationMessages.ConvertCodeToMsg(ModelState, validation.ErrorDict); return(View("DeleteClassification", _Manager.GetClassificationFromID(id))); }
public ActionResult CreateClassification(Classification classification) { AuthorizeAndRedirect(); ClassificationValidation validation = _Manager.CreateClassification(classification); if (!validation.IsValid) { ValidationMessages.ConvertCodeToMsg(ModelState, validation.ErrorDict); return(RedirectToAction("CreateClassification")); } ModelState.Clear(); return(RedirectToAction("BrowseAllBooks", "Book", null)); }
public ClassificationValidation CreateClassification(Classification classification) { ClassificationValidation validation = new ClassificationValidation(classification); if (validation.IsValid) { if (!_Repo.CreateClassification(Mapper.Map <Classification, CLASSIFICATION>(classification))) { validation.FailedToCreateClassification(nameof(classification.Signum)); } } return(validation); }
public ClassificationValidation EditClassification(Classification classification) { ClassificationValidation validation = new ClassificationValidation(classification); if (validation.IsValid) { if (!_Repo.EditClassification(Mapper.Map <Classification, CLASSIFICATION>(classification))) { validation.DoesNotExistOnServer(nameof(classification.Signum)); } } return(validation); }
public ClassificationValidation DeleteClassification(Classification classification) { ClassificationValidation validation = new ClassificationValidation(classification); if (_Repo.DoesClassificationContainBooks(Mapper.Map <CLASSIFICATION>(classification))) { validation.BooksExistInClassification(nameof(classification.Signum)); } else if (!_Repo.DeleteClassification(Mapper.Map <Classification, CLASSIFICATION>(classification))) { validation.DoesNotExistOnServer(nameof(classification.Signum)); } return(validation); }