Exemplo n.º 1
0
 public ActionResult CreateUser(AdminUser user)
 {
     if (ModelState.IsValid)
     {
         data.CreateUser(user, (Session["LoggedInUser"] as user).id);
         return RedirectToAction("ListUsers");
     }
     return View(user);
 }
Exemplo n.º 2
0
        public void CreateUser(AdminUser user, int createdBy)
        {
            user u = new user
                    {
                        username = user.Username,
                        is_admin = user.IsAdmin,
                        is_deleted = false,
                        password = user.Password,
                        createdat = DateTime.Now,
                        createdby = createdBy,
                        updatedat = DateTime.Now,
                        updatedby = createdBy
                    };

                dbContext.users.Add(u);
                dbContext.SaveChanges();
        }
Exemplo n.º 3
0
 public void UpdateUser(AdminUser user, int updatedBy)
 {
     var oldUser = dbContext.users.First(u => u.id == user.UserId);
         {
             oldUser.username = user.Username;
             oldUser.is_admin = user.IsAdmin;
             oldUser.password = user.Password;
             oldUser.updatedat = DateTime.Now;
             oldUser.updatedby = updatedBy;
             dbContext.SaveChanges();
         }
 }