コード例 #1
0
        public ActionResult AddProductType(CreateProductTypeRequest createRequest)
        {
            var newProductType = _productTypeRepository.AddProductType(
                createRequest.Name);

            return(Created($"/api/target/{newProductType.Id}", newProductType));
        }
コード例 #2
0
        public ActionResult AddProductType(CreateProductTypeRequest createRequest)
        {
            if (_validator.Validate(createRequest))
            {
                return(BadRequest("All product types must have a name."));
            }

            var newProductType = _repository.AddProductType(createRequest.ProductName);

            return(Created($"api/productType/{newProductType.Id}", newProductType));
        }
コード例 #3
0
        public ActionResult <int> AddProductType(CreateProductTypeRequest createRequest)
        {
            var newProductType = _productTypeRepository.AddProductType(createRequest.Category);

            return(Created($"api/productType/{newProductType.ProductTypeId}", newProductType));
        }
コード例 #4
0
        public void Create(AddProductTypeCommand newProductType)
        {
            var repo = new ProductTypeRepository();

            repo.AddProductType(newProductType);
        }