Exemplo n.º 1
0
        public ActionResult Create(UserViewModel userviewmodel)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(UserViewModel.CreateFromViewModel(userviewmodel));
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userviewmodel));
        }
Exemplo n.º 2
0
 public ActionResult Edit(UserViewModel userviewmodel)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(userviewmodel).State = EntityState.Modified;
         var user = UserViewModel.CreateFromViewModel(userviewmodel);
         this.db.Users.Update(user);
         this.db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userviewmodel));
 }