Пример #1
0
        public ActionResult Edit(EditVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            User item = new User();

            item.Id        = model.Id;
            item.Username  = model.Username;
            item.Password  = model.Password;
            item.FirstName = model.FirstName;
            item.LastName  = model.LastName;

            PartifyDbContext context = new PartifyDbContext();
            DbEntityEntry    entry   = context.Entry(item);

            entry.State = EntityState.Modified;
            context.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
Пример #2
0
        public ActionResult Edit(EditVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            User loggedUser = (User)Session["loggedUser"];

            Party item = new Party();

            item.Id          = model.Id;
            item.Title       = model.Title;
            item.Description = model.Description;
            item.OwnerId     = loggedUser.Id;

            PartifyDbContext context = new PartifyDbContext();
            DbEntityEntry    entry   = context.Entry(item);

            entry.State = EntityState.Modified;
            context.SaveChanges();

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