예제 #1
0
 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));
     }
 }
예제 #2
0
        /// <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));
            }
        }