public ActionResult deleteLeaves(int id) { ApplyLeave obj = new ApplyLeave(); obj = ApplyLeave.getLeaveInfo(id); if (obj.StartDate.Date > DateTime.Now.Date || obj.Status == "Approval Pending") { if (ApplyLeave.deleteLeave(id)) { return(RedirectToAction("ViewLeaves", "ApplyLeave")); } else { return(RedirectToAction("Index", "LTLogin")); } } else { return(RedirectToAction("ViewLeaves", "ApplyLeave")); } }