Beispiel #1
0
        public IHttpActionResult Create(Boss boss)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Context.Bosses.Add(boss);
            Context.SaveChanges();

            return Ok();
        }
Beispiel #2
0
        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();
        }