public ActionResult Create(AcheivementPhraseViewModel model) { try { // TODO: Add insert logic here if (!ModelState.IsValid) { return(View(model)); } var AcheivementPhrase = _mapper.Map <AcheivementPhrase>(model); var isSuccess = _repo.Create(AcheivementPhrase); if (!isSuccess) { ModelState.AddModelError("", "Something Went Wrong!"); return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Something Went Wrong!"); return(View(model)); } }
public ActionResult Delete(int id, AcheivementPhraseViewModel model) { try { // TODO: Add delete logic here var AcheivementPhrase = _repo.FindById(id); if (AcheivementPhrase == null) { return(NotFound()); } var isSuccess = _repo.Delete(AcheivementPhrase); if (!isSuccess) { return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { return(View(model)); } }