示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Order).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(Order.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Product.Add(Product);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["CustomerId"] = new SelectList(_context.Customer, "ID", "LastName");
                return(Page());
            }

            _context.Case.Add(Case);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["CustomerId"] = new SelectList(_context.Customer, "ID", "LastName");
                return(Page());
            }

            _context.Order.Add(Order);
            await _context.SaveChangesAsync();

            return(RedirectToPage("/Orders/Details", new { id = Order.ID }));
        }
示例#5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Case = await _context.Case.FindAsync(id);

            if (Case != null)
            {
                _context.Case.Remove(Case);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Product = await _context.Product.FindAsync(id);

            if (Product != null)
            {
                _context.Product.Remove(Product);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OrderLineItem = await _context.OrderLineItem.FindAsync(id);

            if (OrderLineItem != null)
            {
                _context.OrderLineItem.Remove(OrderLineItem);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }