Exemplo n.º 1
0
        public async Task <AddProductResponse> AddProductAsync([FromBody] AddProductRequest request)
        {
            AddProductRequestValidator validator = new AddProductRequestValidator();

            validator.EnsureValid(request);
            var response = await _productService.AddProductAsync(request.ToEntity());

            return(response.ToModel());
        }
Exemplo n.º 2
0
 public static Contracts.AddProductRequest ToEntity(this AddProductRequest addProductRequest)
 {
     Contracts.AddProductRequest request = new Contracts.AddProductRequest()
     {
         SellerId      = addProductRequest.SellerId,
         Name          = addProductRequest.Name,
         Description   = addProductRequest.Description,
         HeroImage     = addProductRequest.HeroImage,
         Price         = addProductRequest.Price.ToEntity(),
         Category      = addProductRequest.Category.ToEntity(),
         Images        = addProductRequest.Images,
         PurchasedDate = addProductRequest.PurchasedDate,
         PickupAddress = addProductRequest.PickupAddress.ToEntity()
     };
     return(request);
 }