public async Task PutAccountasync(int id, TblCharityAccount tblCharityAccount) { _db.Entry(tblCharityAccount).State = EntityState.Modified; await _db.SaveChangesAsync(); }
public async Task <TblCharityAccount> PostAccountasync(TblCharityAccount tblCharityAccount) { _db.TblCharityAccounts.Add(tblCharityAccount); await _db.SaveChangesAsync(); return(tblCharityAccount); }
public bool delete(TblCharityAccount tblCharityAccount) { { try { _db.TblCharityAccounts.Remove(tblCharityAccount); _db.SaveChanges(); return(true); } catch (Exception) { return(false); } } }
public async Task <ActionResult <TblCharityAccount> > PostTblCharityAccount(TblCharityAccount tblCharityAccount) { try { await _CharityAccounts.PostAccountasync(tblCharityAccount); } catch (DbUpdateException) { if (TblCharityAccountExists(tblCharityAccount.CharityAccountId)) { return(Conflict()); } else { throw; } } return(Ok(CreatedAtAction("GetAccountbuyidanysk", new { id = tblCharityAccount.CharityAccountId }, tblCharityAccount))); }
public async Task <ActionResult <TblCharityAccount> > PutTblCharityAccount(int id, TblCharityAccount tblCharityAccount) { if (id != tblCharityAccount.CharityAccountId) { return(BadRequest("bad request")); } try { await _CharityAccounts.PutAccountasync(id, tblCharityAccount); } catch (DbUpdateException) { if (TblCharityAccountExists(tblCharityAccount.CharityAccountId)) { return(Conflict()); } else { throw; } } return(Ok(NoContent())); }