public ActionResult Create(PunctualityPhraseViewModel model) { try { // TODO: Add insert logic here if (!ModelState.IsValid) { return(View(model)); } var PunctualityPhrase = _mapper.Map <PunctualityPhrase>(model); var isSuccess = _repo.Create(PunctualityPhrase); 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, PunctualityPhraseViewModel model) { try { // TODO: Add delete logic here var PunctualityPhrase = _repo.FindById(id); if (PunctualityPhrase == null) { return(NotFound()); } var isSuccess = _repo.Delete(PunctualityPhrase); if (!isSuccess) { return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { return(View(model)); } }