public async Task <Contact> Create(Contact entity)
        {
            try
            {
                _db.Set <Contact>().Add(entity);
                await _db.SaveChangesAsync();

                return(entity);
            }
            catch (Exception ex)
            {
                //log exception
                return(null);
            }
        }
        public async Task <Address> Create(Address entity)
        {
            try
            {
                _db.Set <Address>().Add(entity);
                await _db.SaveChangesAsync();

                return(entity);
            }
            catch (Exception ex)
            {
                //log exception
                return(null);
            }
        }
示例#3
0
 public bool AddItem(T item)
 {
     _context.Set <T>().Add(item);
     return(SaveChanges());
 }