public ActionResult Index(Leave le) { LeaveManager lm = new LeaveManager(); if (le.LeaveTime < DateTime.Now) { if (le.LeaveTime < le.LeaveResult) { le.UserId = Convert.ToInt32(Request.Form["UserId"]); le.LeaveTime = Convert.ToDateTime(Request.Form["LeaveTime"]); le.LeaveOver = "未批准"; le.Leave_Condition = "可见"; bool b = lm.Add(le); if (b) { return(Redirect("/LiuXin/Leave/Query"));; } return(Content("<script>alert('批准失败');window.location.href='/LiuXin/Leave/Query';</script>")); } else { return(Content("<script>alert('请输入合理的返校时间');window.location.href='/LiuXin/Leave/Query';</script>")); } } else { return(Content("<script>alert('请输入合理的请假时间');window.location.href='/LiuXin/Leave/Query';</script>")); } }