Exemple #1
0
        public async Task <T> Add(T entity)
        {
            await _context.AddAsync(entity);

            await Save();

            return(entity);
        }
Exemple #2
0
        public async Task <Car> AddCar(AddCarCommand addCarCommand)
        {
            Car car = new Car
            {
                Manufacture   = addCarCommand.Manufacture,
                Model         = addCarCommand.Model,
                Year          = addCarCommand.Year,
                Vin           = addCarCommand.Vin,
                Description   = addCarCommand.Description,
                IsAvailable   = addCarCommand.IsAvailable,
                CarGroupId    = addCarCommand.CarGroupId,
                Observation   = addCarCommand.Observation,
                StandardPrice = addCarCommand.StandardPrice,
                DateCreated   = addCarCommand.DateCreated,
                CreatedBy     = addCarCommand.CreatedBy
            };
            await _dbContext.AddAsync(car);

            await _dbContext.SaveChangesAsync();

            return(car);
        }