Exemplo n.º 1
0
        public async Task <bool> Create(VehicleColor entity)
        {
            if (entity == null)
            {
                return(false);
            }

            entity.CreationDate = DateTime.Now;
            entity.UpdateDate   = DateTime.Now;
            entity.Active       = true;

            await _dbContext.AddAsync(entity);

            var result = await _dbContext.SaveChangesAsync();

            return(result > 0);
        }
Exemplo n.º 2
0
        public async Task <bool> Create(Client entity)
        {
            if (entity == null)
            {
                return(false);
            }

            entity.CreationDate = DateTime.Now;
            entity.UpdateDate   = DateTime.Now;
            entity.Active       = true;
            try
            {
                await _dbContext.AddAsync(entity);

                var result = await _dbContext.SaveChangesAsync();

                return(result > 0);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }