Ejemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StoreProduct = await _storeProductService.GetByIdAsync(id.Value);

            if (StoreProduct != null)
            {
                await _storeProductService.RemoveAsync(StoreProduct);
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StoreProduct =
                await _storeProductService.GetByIdAsync(id.Value);

            if (StoreProduct == null)
            {
                return(NotFound());
            }

            return(Page());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StoreProduct =
                await _storeProductService.GetByIdAsync(id.Value);

            if (StoreProduct == null)
            {
                return(NotFound());
            }

            ViewData["ProductId"] = new SelectList(await _productService.ListAsync(), "Id", "Name");
            ViewData["StoreId"]   = new SelectList(await _storeService.ListAsync(), "Id", "Id");
            return(Page());
        }