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