public IHttpActionResult Create(Faction faction) { if (!ModelState.IsValid) { return BadRequest(ModelState); } Context.Factions.Add(faction); Context.SaveChanges(); return Ok(); }
public IHttpActionResult Update(int id, Faction faction) { faction.Id = id; if (!ModelState.IsValid) { return BadRequest(ModelState); } Context.Factions.Attach(faction); var entry = Context.Entry(faction); entry.State = EntityState.Modified; Context.SaveChanges(); return Ok(); }