Esempio n. 1
0
        public ActionResult Index()
        {
            List <User>     users           = db.Users.ToList();
            UsersResponseVM usersResponseVM = new UsersResponseVM()
            {
                Users = users
            };

            return(View(usersResponseVM));
        }
Esempio n. 2
0
 public ActionResult ManageSold(UsersResponseVM usersResponseVM)
 {
     if (ModelState.IsValid)
     {
         User user = usersResponseVM.User;
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     return(View(usersResponseVM));
 }
Esempio n. 3
0
        public ActionResult ManageSold(int id)
        {
            User user = db.Users.Find(id);

            UsersResponseVM usersResponseVM = new UsersResponseVM
            {
                User = user
            };

            return(View(usersResponseVM));
        }
Esempio n. 4
0
        public ActionResult Edit(UsersResponseVM userVM)
        {
            if (ModelState.IsValid)
            {
                User user = userVM.User;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();


                Response.Cookies["userId"]["name"]   = user.FirstName;
                Response.Cookies["userId"]["roleId"] = user.RoleID.ToString();

                return(RedirectToAction("Index", "Home"));
            }

            return(View(userVM));
        }
Esempio n. 5
0
        // GET: User/Edit/id
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = db.Users.Find(id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            UsersResponseVM usersResponseVM = new UsersResponseVM()
            {
                User = user
            };

            return(View(usersResponseVM));
        }