public IHttpActionResult PostGatavaShemaModulis(GatavaShemaModulis gatavaShemaModulis) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.GatavasShemasModulis.Add(gatavaShemaModulis); try { db.SaveChanges(); } catch (DbUpdateException) { if (GatavaShemaModulisExists(gatavaShemaModulis.Gatavā_shēma_moduļa_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("BatmanApi-GatavaShemaModulis", new { id = gatavaShemaModulis.Gatavā_shēma_moduļa_ID }, gatavaShemaModulis)); }
public IHttpActionResult PutGatavaShemaModulis(int id, GatavaShemaModulis gatavaShemaModulis) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gatavaShemaModulis.Gatavā_shēma_moduļa_ID) { return(BadRequest()); } db.Entry(gatavaShemaModulis).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GatavaShemaModulisExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetGatavaShemaModulis(int id) { GatavaShemaModulis gatavaShemaModulis = db.GatavasShemasModulis.Find(id); if (gatavaShemaModulis == null) { return(NotFound()); } return(Ok(gatavaShemaModulis)); }
public IHttpActionResult DeleteGatavaShemaModulis(int id) { GatavaShemaModulis gatavaShemaModulis = db.GatavasShemasModulis.Find(id); if (gatavaShemaModulis == null) { return(NotFound()); } db.GatavasShemasModulis.Remove(gatavaShemaModulis); db.SaveChanges(); return(Ok(gatavaShemaModulis)); }