//public async Task<ActionResult<SBaccount>> PostSBaccount(SBaccount sBaccount) //{ // _context.Sbaccount.Add(sBaccount); // await _context.SaveChangesAsync(); // return CreatedAtAction("GetSBaccount", new { id = sBaccount.CustomerId }, sBaccount); //} public async Task <ActionResult <SBaccount> > PostSBAccount(SBaccount sBAccount) { _context.Sbaccount.Add(sBAccount); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSBAccount", new { id = sBAccount.CustomerId }, sBAccount)); }
public async Task <IActionResult> PutSBaccount(int id, SBaccount sBaccount) { if (id != sBaccount.CustomerId) { return(BadRequest()); } _context.Entry(sBaccount).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SBaccountExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }