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



            return(Ok());
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 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));
 }
Exemplo n.º 7
0
        public async Task <ActionResult> DeleteConfirmedAsync(int id)
        {
            await categoryService.DeleteCategoryAsync(id);

            return(RedirectToAction("Index"));
        }