public async Task <IHttpActionResult> Postevloc(evloc evloc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.evloc.Add(evloc); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (evlocExists(evloc.evloc1)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = evloc.evloc1 }, evloc)); }
public async Task <IHttpActionResult> Putevloc(int id, evloc evloc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != evloc.evloc1) { return(BadRequest()); } db.Entry(evloc).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!evlocExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getevloc(int id) { evloc evloc = await db.evloc.FindAsync(id); if (evloc == null) { return(NotFound()); } return(Ok(evloc)); }
public async Task <IHttpActionResult> Deleteevloc(int id) { evloc evloc = await db.evloc.FindAsync(id); if (evloc == null) { return(NotFound()); } db.evloc.Remove(evloc); await db.SaveChangesAsync(); return(Ok(evloc)); }