public IActionResult DoAction(string id, string act) { int?uid = HttpContext.Session.GetInt32("uid"); if (uid == null) { return(RedirectToAction("Login", "Login")); } int askId; if (!Int32.TryParse(id, out askId)) { return(RedirectToAction("List", "AskForLeave")); } AskForLeave ask = AskForLeaveService.FindAskForLeaveById(askId); if (ask == null) { return(RedirectToAction("List", "AskForLeave")); } if (act.Equals("reject")) { AskForLeaveService.RejectAskForLeave(ask); } else if (act.Equals("approve")) { AskForLeaveService.AskFlowToNextSupervisor(ask); } return(RedirectToAction("Home", "Home")); }
public IActionResult Detail(string id) { int?uid = HttpContext.Session.GetInt32("uid"); if (uid == null) { return(RedirectToAction("Login", "Login")); } int i; if (null == id || !Int32.TryParse(id, out i)) { return(RedirectToAction("List", "AskForLeave")); } AskForLeave ask = AskForLeaveService.FindAskForLeaveById(i); AskForLeaveDetailViewModel model = new AskForLeaveDetailViewModel(ask); return(View(model)); }