public IActionResult Approve(int leaveId, int empid) { try { int id = leaveService.ApproveLeave(leaveId, empid); return(RedirectToAction("Index", "Employee", new { id })); } catch (Exception e) { ErrorViewModel errorView = new ErrorViewModel(); errorView.Message = "Error Occured while approving leave"; errorView.Reason = e.Message; return(RedirectToAction("Error", "ErrorHandling", errorView)); } }
/// <summary> /// Manager can approve the submitted leaves /// </summary> /// <param name="leaveId">id of leave</param> /// <returns>Leave details</returns> public IActionResult Approve(int leaveId) { try { int empid = Convert.ToInt32(HttpContext.Session.GetInt32("id")); ViewBag.login = 1; LeaveService leaveService = new LeaveService(); int id = leaveService.ApproveLeave(leaveId, empid); return(RedirectToAction("Index", "Employee", new { id })); } catch (Exception e) { ErrorViewModel errorView = new ErrorViewModel(); errorView.Message = "Error Occured while approving leave"; errorView.Reason = e.Message; return(RedirectToAction("Error", "ErrorHandling", errorView)); } }