public IHttpActionResult PutMatch(int id, Match match) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != match.Id) { return(BadRequest()); } db.Entry(match).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MatchExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public Match Create(MatchModel item) { var match = _converter.GetEntityByModel(item); _dbContext.Matches.Add(match); _dbContext.SaveChanges(); return(match); }