Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public bool AddItem(T item)
 {
     _context.Set <T>().Add(item);
     return(SaveChanges());
 }