Exemple #1
0
 public IHttpActionResult Post(NewProductCandidate value)
 {
     return(this.Ok(new
     {
         result = this.ProductService.Add(value)
     }));
 }
        public Product Add(NewProductCandidate candidate)
        {
            Guard.ArgumentIsNull(candidate, "candidate");
            Guard.ArgumentIsEmpty(candidate.Name, "name");
            Guard.ArgumentIsEmpty(candidate.SKU, "SKU");

            return(this.SaveAndCreate(candidate));
        }
        private Product SaveAndCreate(NewProductCandidate candidate)
        {
            var entity = this.ProductRepository.Create();

            entity.Name        = candidate.Name;
            entity.SKU         = candidate.SKU;
            entity.Environment = this.UserContext.Environment;

            this.Save();
            return(entity);
        }
 public ProductDto Add(NewProductCandidate candidate)
 {
     return(this.ProductManager.Add(candidate).ToProductDto());
 }