示例#1
0
        public ActionResult AddClass(FormCollection form)                           // thêm lớp
        {
            if (!user.IsAdmin())
            {
                return(View("Error"));
            }
            Model.UpdateLastSeen("Thêm Khóa", Url.Action("AddGrade"));
            string class_name    = form["class_name"];
            int    id_speciality = Convert.ToInt32(form["id_speciality"]);
            int    id_grade      = Convert.ToInt32(form["id_grade"]);
            bool   add           = Model.AddClass(class_name, id_grade, id_speciality);

            if (add)
            {
                TempData["status_id"] = true;
                TempData["status"]    = "Thêm Thành Công";
            }
            else
            {
                TempData["status_id"] = false;
                TempData["status"]    = "Thêm Thất Bại";
            }
            return(RedirectToAction("ClassManager"));
        }