Пример #1
0
 private static void UpdateEntity(ProductBase model, Entities.Product entity)
 {
     entity.Name      = model.Name;
     entity.LatinName = model.LatinName;
     entity.Price     = model.Price;
     entity.Quantity  = model.Quantity;
 }
Пример #2
0
        public async Task <Product> CreateAsync(ProductBase model)
        {
            model.ValidateIsNotNull(nameof(model));

            var entity = new Entities.Product();

            UpdateEntity(model, entity);

            await _genericRepository.InsertAsync(entity);

            await _databaseScope.SaveChangesAsync();

            return(_mapper.Map <Product>(entity));
        }