Beispiel #1
0
        public async Task <IActionResult> Create(ProductCategoryViewModel productCategoryModel)
        {
            if (ModelState.IsValid)
            {
                await _service.CreateProductCategoryAsync(productCategoryModel);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productCategoryModel));
        }
Beispiel #2
0
        public async Task <IActionResult> CreateProductCategory([FromRoute] Guid restaurantId, [FromBody] CreateProductCategoryRequest createProductCategoryRequest)
        {
            var newProductCategoryId = new Guid();

            var productCategory = new ProductCategory
            {
                Id = newProductCategoryId,
                ProductCategoryName = createProductCategoryRequest.ProductCategoryName,
                RestaurantId        = restaurantId
            };

            await _productCategoryService
            .CreateProductCategoryAsync(productCategory);

            /*var locationUri = _uriService.GetRestaurantUri(restaurant.Id.ToString());
             * return Created(locationUri, new Response<RestaurantResponse>(_mapper.Map<RestaurantResponse>(restaurant)));*/

            return(Ok(new Response <ProductCategoryResponse>(_mapper.Map <ProductCategoryResponse>(productCategory))));
        }
Beispiel #3
0
        public async Task <Guid> Create([FromBody] ProductCategoryRequestModels.Create rq)
        {
            var productCategoryId = await _productCategoryService.CreateProductCategoryAsync(rq);

            return(productCategoryId);
        }