Exemplo n.º 1
0
        public async Task <IHttpActionResult> PutVideoGame(int id, VideoGame videoGame)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != videoGame.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VideoGameExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
 public ResponseStatusMessages  Edit(VideoGame videoGame)
 {
     try
     {
         _db.Entry(videoGame).State = EntityState.Modified;
         Save();
         return(ResponseStatusMessages.Done);
     }
     catch
     {
         return(ResponseStatusMessages.ItemNotFound);
     }
 }