예제 #1
0
 public IHttpActionResult Put(EditProductDisplayNameCandidate candidate)
 {
     return(this.Ok(new
     {
         result = this.ProductDisplayNameService.UpdateProductDisplayName(candidate)
     }));
 }
예제 #2
0
        public ProductDisplayName UpdateById(EditProductDisplayNameCandidate candidate)
        {
            Guard.ArgumentIsNull(candidate, "candidate");
            Guard.ArgumentIsEmpty(candidate.LocaleName, "localename");

            var existing = this.ProductDisplayNameRepository.GetById(candidate.Id);

            if (existing == null)
            {
                throw new ProductDisplayNameDoesNotExistsException("Product name does not exists for this product.");
            }

            if (existing.Product.Environment != this.UserContext.Environment)
            {
                throw new ProductDoesNotExistsException();
            }

            existing.LocalDisplayName = candidate.LocaleName;
            this.Save();

            return(existing);
        }
 public ProductDisplayNameDto UpdateProductDisplayName(EditProductDisplayNameCandidate candidate)
 {
     return(this.ProductDisplayNameManager.UpdateById(candidate).ToProductDisplayNameDto());
 }