예제 #1
0
        public async Task <IActionResult> OnPostDelete()
        {
            if (!await _invManager.ProductExists(ID.GetValueOrDefault()))
            {
                return(RedirectToPage("/Admin/Products/Index"));
            }
            await _invManager.DeleteProduct(ID.GetValueOrDefault());

            return(RedirectToPage("/Admin/Products/Index"));
        }
예제 #2
0
        [HttpGet("product/delete/{productId}")]                          //check if want to make it delete type
        public ActionResult <ResponseModel> DeleteProduct(int productId) //add dto here to protect the id //but no need in a way,since we may have to share id anyway
        {
            var success = _inventoryManager.DeleteProduct(productId);

            if (success)
            {
                return(Ok());
            }
            return(BadRequest());
        }
        public async Task <IActionResult> OnPostDelete()
        {
            await _product.DeleteProduct(ID.GetValueOrDefault());

            return(RedirectToPage("ProductManagement"));
        }
        public async Task <IActionResult> OnGet()
        {
            await _product.DeleteProduct(ID);

            return(RedirectToPage("ProductManagement"));
        }