コード例 #1
0
        public async Task <bool> SaveClientReceiptAsync(ClientReceipt receipt)
        {
            if (_context.Entry(receipt).State == EntityState.Detached)
            {
                _context.Add(receipt);
            }
            else if (_context.Entry(receipt).State == EntityState.Modified)
            {
                _context.Update(receipt);
            }

            if (_context.Entry(receipt).State == EntityState.Unchanged)
            {
                return(true);
            }

            return(await _context.SaveChangesAsync() > 0);
        }
コード例 #2
0
 public async Task <bool> DeleteClientReceiptAsync(ClientReceipt receipt)
 {
     _context.Remove(receipt);
     return(await _context.SaveChangesAsync() > 0);
 }