Beispiel #1
0
        //Updates the Bid
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BidExists(Bid.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        //Adds  a bid record to database.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Bid.Add(Bid);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        //Removes the product from the databse. Uses a linq query to get the product.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Product = (from product in _context.Product
                       where product.Id == id
                       select product).FirstOrDefault();

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

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        //Removes the bid from the databse. Alinq query is uses to get bit record from databse.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Bid = (from bid in _context.Bid

                   where bid.Id == id
                   select bid).FirstOrDefault();

            if (Bid != null)
            {
                _context.Bid.Remove(Bid);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
        //Deletes the buyer record uses a linq query to get the buyer.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Buyer = (from buyer in _context.Buyer

                     where buyer.Id == id
                     select buyer).FirstOrDefault();

            if (Buyer != null)
            {
                _context.Buyer.Remove(Buyer);
                _context.SaveChanges();
            }

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