public async Task <IHttpActionResult> Posttbl_DTCTBrand(tbl_DTCTBrand tbl_DTCTBrand) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_DTCTBrand.Add(tbl_DTCTBrand); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (tbl_DTCTBrandExists(tbl_DTCTBrand.Brand_id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tbl_DTCTBrand.Brand_id }, tbl_DTCTBrand)); }
public async Task <IHttpActionResult> Puttbl_DTCTBrand(string id, tbl_DTCTBrand tbl_DTCTBrand) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_DTCTBrand.Brand_id) { return(BadRequest()); } db.Entry(tbl_DTCTBrand).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tbl_DTCTBrandExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Gettbl_DTCTBrand(string id) { tbl_DTCTBrand tbl_DTCTBrand = await db.tbl_DTCTBrand.FindAsync(id); if (tbl_DTCTBrand == null) { return(NotFound()); } return(Ok(tbl_DTCTBrand)); }
public async Task <IHttpActionResult> Deletetbl_DTCTBrand(string id) { tbl_DTCTBrand tbl_DTCTBrand = await db.tbl_DTCTBrand.FindAsync(id); if (tbl_DTCTBrand == null) { return(NotFound()); } db.tbl_DTCTBrand.Remove(tbl_DTCTBrand); await db.SaveChangesAsync(); return(Ok(tbl_DTCTBrand)); }