示例#1
0
        public ActionResult CreateTest(FormCollection form)
        {
            if (!user.IsManager())
            {
                return(View("Error"));
            }
            DateTime date = Convert.ToDateTime(form["date"]);
            TimeSpan time = TimeSpan.Parse(form["time"]);
            Test     test = new Test();

            test.TimeStart = date + time;
            test.Note      = form["note"];

            bool check = managerDal.CreateTest(test);

            if (check)
            {
                TempData["check"]     = true;
                TempData["statusCTC"] = "Create test successfull!!!!";
            }
            else
            {
                TempData["check"]     = false;
                TempData["statusCTC"] = "Create test falsed!!!!--The time is not valid";
            }

            return(RedirectToAction("CreateTest"));
        }