Exemplo n.º 1
0
        public ActionResult EditStudent(FormCollection form)                            // sửa thông tin học sinh
        {
            if (!user.IsAdmin())
            {
                return(View("Error"));
            }
            int    id_student    = Convert.ToInt32(form["id_student"]);
            string name          = form["name"];
            string username      = form["username"];
            string password      = form["password"];
            string email         = form["email"];
            string gender        = form["gender"];
            string birthday      = form["birthday"];
            int    id_speciality = Convert.ToInt32(form["id_speciality"]);
            int    id_class      = Convert.ToInt32(form["id_class"]);
            bool   edit          = Model.EditStudent(id_student, name, username, password, gender, email, birthday, id_speciality, id_class);

            if (edit)
            {
                TempData["status_id"] = true;
                TempData["status"]    = "Sửa Thành Công";
            }
            else
            {
                TempData["status_id"] = false;
                TempData["status"]    = "Sửa Thất Bại";
            }
            return(RedirectToAction("EditStudent/" + id_student));
        }