public IHttpActionResult PostV_UserMenu(V_UserMenu v_UserMenu) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.V_UserMenu.Add(v_UserMenu); try { db.SaveChanges(); } catch (DbUpdateException) { if (V_UserMenuExists(v_UserMenu.Name)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = v_UserMenu.Name }, v_UserMenu); }
public IHttpActionResult PutV_UserMenu(string id, V_UserMenu v_UserMenu) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != v_UserMenu.Name) { return BadRequest(); } db.Entry(v_UserMenu).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!V_UserMenuExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }