Пример #1
0
        public JsonResult PutUser(int id, User user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != user.User_ID)
            {
                return(BadRequest());
            }

            db.Entry(user).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Game_ID,Game_Name,Max_Player_Count")] Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(game));
 }
 public ActionResult Edit([Bind(Include = "Id,Game_Session_ID,Users_ID")] Session_Users session_Users)
 {
     if (ModelState.IsValid)
     {
         db.Entry(session_Users).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Game_Session_ID = new SelectList(db.Game_Sessions, "Game_Session_ID", "Game_Session_ID", session_Users.Game_Session_ID);
     ViewBag.Users_ID        = new SelectList(db.Users, "User_ID", "User_Name", session_Users.Users_ID);
     return(View(session_Users));
 }