Пример #1
0
        public ActionResult EditUser([Bind(Include = "ID,User_Type_ID,User_First_Name,User_Last_Name,User_Phone_Number,User_Email,User_ID,User_Password")] User user)
        {
            if (ModelState.IsValid)
            {
                user.User_Password_Salt = HashPasswordService.CreateSalt();

                user.User_Password = HashPasswordService.CreateHash(user.User_Password, user.User_Password_Salt);

                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("UsersList"));
            }

            ViewBag.User_Type_ID = new SelectList(db.User_Type, "ID", "Type", user.User_Type_ID);
            return(View(user));
        }
Пример #2
0
        public ActionResult EditCourse([Bind(Include = "CourseID,Course_Name,Course_Code,Course_Description,Course_Credit,Course_Instructor_ID,Course_Assistant_ID")] Course course)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(course).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("CoursesList"));
                }
            }
            catch (Exception e)
            {
                return(View("Error", e));
            }

            return(View(course));
        }