// POST: odata/Stopa_PDV_a public async Task <IHttpActionResult> Post(Stopa_PDV_a stopa_pdv_a) { if (!LoginController.CheckAuthorizationForRequest(Request)) { return(Unauthorized()); } if (!ModelState.IsValid || !stopa_pdv_a.ValidateOcl()) { return(BadRequest(ModelState)); } db.Stopa_PDV_a.Add(stopa_pdv_a); await db.SaveChangesAsync(); return(Created(stopa_pdv_a)); }
// DELETE: odata/Stopa_PDV_a(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { if (!LoginController.CheckAuthorizationForRequest(Request)) { return(Unauthorized()); } Stopa_PDV_a stopa_pdv_a = await db.Stopa_PDV_a.FindAsync(key); if (stopa_pdv_a == null) { return(NotFound()); } db.Stopa_PDV_a.Remove(stopa_pdv_a); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/Stopa_PDV_a(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <Stopa_PDV_a> patch) { if (!LoginController.CheckAuthorizationForRequest(Request)) { return(Unauthorized()); } Validate(patch.GetEntity()); if (!ModelState.IsValid || !patch.GetEntity().ValidateOcl()) { return(BadRequest(ModelState)); } Stopa_PDV_a stopa_pdv_a = await db.Stopa_PDV_a.FindAsync(key); if (stopa_pdv_a == null) { return(NotFound()); } patch.Put(stopa_pdv_a); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Stopa_PDV_aExists(key)) { return(NotFound()); } else { throw; } } return(Updated(stopa_pdv_a)); }