public IHttpActionResult Patch([FromODataUri] int key, System.Web.OData.Delta<Group> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return BadRequest(ModelState); } Group group = db.Groups.Find(key); if (group == null) { return NotFound(); } patch.Patch(group); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GroupExists(key)) { return NotFound(); } else { throw; } } return Updated(group); }
public IHttpActionResult Patch([FromODataUri] int key, System.Web.OData.Delta<PaymentMode> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return BadRequest(ModelState); } PaymentMode Item = _PaymentModeService.GetById (key); if (Item == null) { return NotFound(); } patch.Patch(Item); try { _PaymentModeService.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!_PaymentModeService.Exists(key)) { return NotFound(); } else { throw; } } return Updated(Item); }