public async Task <ActionResult <Shippng> > PostShippng(Shippng shippng) { AccountsController accres = new AccountsController(dbObj); shippng.AccId = accres.getAccountResponseID(); dbObj.Shippngs.Add(shippng); try { await dbObj.SaveChangesAsync(); } catch (DbUpdateException) { if (ShippngExists(shippng.ShipId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetShippng", new { id = shippng.ShipId }, shippng)); }
public async Task <ActionResult <Billing> > PostBilling(Billing billing) { AccountsController accres = new AccountsController(testDB1Context); billing.AccId = accres.getAccountResponseID(); testDBobj.Billings.Add(billing); try { await testDBobj.SaveChangesAsync(); } catch (DbUpdateException) { if (BillingExists(billing.BillId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetBilling", new { id = billing.BillId }, billing)); }
public async Task <ActionResult <Account> > PostAccount(Account account) { dbObj.Accounts.Add(account); try { await dbObj.SaveChangesAsync(); } catch (DbUpdateException) { if (AccountExists(account.AccId)) { return(Conflict()); } else { throw; } } var act = CreatedAtAction("GetAccount", new { id = account.AccId }, account); accountID = account.AccId; return(act); }