public async Task <IHttpActionResult> DeleteAsync(int id)
        {
            var productDomain = await categoryService.DeleteCategoryAsync(id);



            return(Ok());
        }
Example #2
0
        public async Task <IHttpActionResult> DeleteProductCategory([FromUri] int id)
        {
            try
            {
                await _categoryService.DeleteCategoryAsync(id);

                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NoContent)));
            }
            catch (RequestedResourceNotFoundException ex)
            {
                return(this.BadRequest(ex.Message));
            }
            catch (RequestedResourceHasConflictException ex)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Conflict, ex.Message)));
            }
            catch (Exception)
            {
                return(this.InternalServerError());
            }
        }
Example #3
0
        public async Task <IHttpActionResult> DeleteProductCategoryAsync([FromUri] int id)
        {
            if (id < 1)
            {
                return(BadRequest($"Argument {nameof(id)} must be greater than zero."));
            }

            try
            {
                await _categoryService.DeleteCategoryAsync(id);

                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NoContent)));
            }
            catch (RequestedResourceHasConflictException)
            {
                return(Conflict());
            }
            catch (RequestedResourceNotFoundException)
            {
                return(NotFound());
            }
        }
Example #4
0
        public async Task <IActionResult> DeleteProductCategory(int id)
        {
            await _categoryService.DeleteCategoryAsync(id);

            return(NoContent());
        }
        public async Task <IHttpActionResult> DeleteProductCategory([FromUri] int id)
        {
            await _categoryService.DeleteCategoryAsync(id);

            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NoContent)));
        }
 public async Task <Result <bool> > DeleteCategory(int id)
 {
     return(await productCategoryService.DeleteCategoryAsync(id));
 }
        public async Task <ActionResult> DeleteConfirmedAsync(int id)
        {
            await categoryService.DeleteCategoryAsync(id);

            return(RedirectToAction("Index"));
        }