public IHttpActionResult PutApplTable(int id, ApplTable applTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != applTable.AppId) { return(BadRequest()); } applDb.Entry(applTable).State = EntityState.Modified; try { applDb.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ApplTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetApplTable(int id) { ApplTable applTable = applDb.ApplTables.Find(id); if (applTable == null) { return(NotFound()); } return(Ok(applTable)); }
public IHttpActionResult PostApplTable(ApplTable applTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } applDb.ApplTables.Add(applTable); applDb.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = applTable.AppId }, applTable)); }
public IHttpActionResult DeleteApplTable(int id) { ApplTable applTable = applDb.ApplTables.Find(id); if (applTable == null) { return(NotFound()); } applDb.ApplTables.Remove(applTable); applDb.SaveChanges(); return(Ok(applTable)); }