コード例 #1
0
        public bool TryDeclineAnUpdate(int sellerId, int productTypeId, out ICollection <string> errors)
        {
            errors = new List <string>();

            //check product type existence
            ProductType productType = productTypeRepository.GetBy(productTypeId);

            if (productType == null)
            {
                errors.Add("Could not found product type");
            }
            else if (productType.Status != ProductTypeStatus.Active)            //check product type status
            {
                errors.Add("Product type is unavailable at the moment");
            }

            ProductTypeUpdateRequest updateRequest
                = productTypeRepository.GetUpdateRequest(sellerId, productTypeId);

            if (!errors.Any())
            {
                productType.DeclineUpdateRequest(updateRequest);
                return(true);
            }
            return(false);
        }