Example #1
0
        public async Task <IActionResult> DeleteConfirmed(int ClientId)
        {
            var client = await _context.Clients.FindAsync(ClientId);

            client.IsDeleted = true;
            _context.Update(client);

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,Name,Description,Weight,Barcode,Price")] Product product)
        {
            if (id != product.ProductId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }