public bool UpdateGameSystem(GameSystemEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .GameSystems .Single(e => e.GameSystemId == model.GameSystemId); //question do you change out the gamesystemid since you wouldn't want IU to change the id. entity.GameSystemName = model.GameSystemName; entity.GameForSystem = model.GameForSystem; entity.GameSystemPrice = model.GameSystemPrice; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(GameSystemEdit id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateGameSystemService(); if (!service.UpdateGameSystem(id)) { return(InternalServerError()); } return(Ok()); }