public async Task <IHttpActionResult> PutBaseCustomerType(int id, BaseCustomerType baseCustomerType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != baseCustomerType.Id) { return(BadRequest()); } db.Entry(baseCustomerType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BaseCustomerTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetBaseCustomerType(int id) { BaseCustomerType baseCustomerType = await db.BaseCustomerTypes.FindAsync(id); if (baseCustomerType == null) { return(NotFound()); } return(Ok(baseCustomerType)); }
public async Task <IHttpActionResult> PostBaseCustomerType(BaseCustomerType baseCustomerType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BaseCustomerTypes.Add(baseCustomerType); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = baseCustomerType.Id }, baseCustomerType)); }
public async Task <IHttpActionResult> DeleteBaseCustomerType(int id) { BaseCustomerType baseCustomerType = await db.BaseCustomerTypes.FindAsync(id); if (baseCustomerType == null) { return(NotFound()); } db.BaseCustomerTypes.Remove(baseCustomerType); await db.SaveChangesAsync(); return(Ok(baseCustomerType)); }