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