Beispiel #1
0
        public async Task PutAccountasync(int id, TblCharityAccount tblCharityAccount)
        {
            _db.Entry(tblCharityAccount).State = EntityState.Modified;


            await _db.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task <TblCharityAccount> PostAccountasync(TblCharityAccount tblCharityAccount)
        {
            _db.TblCharityAccounts.Add(tblCharityAccount);
            await _db.SaveChangesAsync();

            return(tblCharityAccount);
        }
Beispiel #3
0
        public bool delete(TblCharityAccount tblCharityAccount)
        {
            {
                try
                {
                    _db.TblCharityAccounts.Remove(tblCharityAccount);
                    _db.SaveChanges();

                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
Beispiel #4
0
 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)));
 }
Beispiel #5
0
        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()));
        }