public async Task <IHttpActionResult> PuttblCustomerAccount(int id, tblCustomerAccount tblCustomerAccount) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblCustomerAccount.CustomerAccountId) { return(BadRequest()); } db.Entry(tblCustomerAccount).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tblCustomerAccountExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GettblCustomerAccount(int id) { tblCustomerAccount tblCustomerAccount = await db.tblCustomerAccounts.FindAsync(id); if (tblCustomerAccount == null) { return(NotFound()); } return(Ok(tblCustomerAccount)); }
public async Task <IHttpActionResult> PosttblCustomerAccount(tblCustomerAccount tblCustomerAccount) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblCustomerAccounts.Add(tblCustomerAccount); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = tblCustomerAccount.CustomerAccountId }, tblCustomerAccount)); }
public async Task <IHttpActionResult> DeletetblCustomerAccount(int id) { tblCustomerAccount tblCustomerAccount = await db.tblCustomerAccounts.FindAsync(id); if (tblCustomerAccount == null) { return(NotFound()); } db.tblCustomerAccounts.Remove(tblCustomerAccount); await db.SaveChangesAsync(); return(Ok(tblCustomerAccount)); }