Пример #1
0
        public async Task <DataResult <Product> > CreateProductAsync(ProductCreationModel productModel)
        {
            Product product = _productMapper.MapBackToEntity(productModel);

            product.CreationDate = DateTime.Now;

            Product addedProduct = await _productRepository.AddAsync(product);

            await _productRepository.SaveAsync();

            return(new DataResult <Product>
            {
                Data = addedProduct,
                ResponseMessageType = ResponseMessageType.Success
            });
        }