Ejemplo n.º 1
0
 public bool CreateUser(Users model)
 {
     using (CMSEntities db = new CMSEntities())
     {
         if (model != null)
         {
             Users aa = new Users();
             aa.Password = model.Password;
             aa.Name = model.Name;
             db.AddToUsers(aa);
             db.SaveChanges();
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
        public ActionResult AddUser(string name, string password)
        {
            if (string.IsNullOrEmpty(name))
            {
                return null;
            }

            Users user = new Users()
            {
                Name = name,
                Password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5")
            };
            var db = new CMSEntities();
            db.Users.AddObject(user);
            db.SaveChanges();

            return PartialView("_UserList", this.GetAllUser());
        }