Пример #1
0
        public async Task <T> Crear <T>(T objeto) where T : class
        {
            try
            {
                if (objeto != null)
                {
                    await contextDb.GetCollection <T>().InsertOneAsync(objeto);

                    return(objeto);
                }
                else
                {
                    throw new ArgumentNullException(typeof(T).Name + " objeto es nulo");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }