//updates the buyer.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 2
0
        //Adds a seller to databae.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Seller.Add(Seller);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 3
0
        //Deletes a seller users a linq query to check existance.
        public IActionResult OnPost(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Seller = (from seller in _context.Seller where seller.Id == id select seller).FirstOrDefault();

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

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 4
0
        //Deletes a transaction uses a linq query to check existence.
        public IActionResult OnPost(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Transaction = (from transaction in _context.Transaction where transaction.TransactionId == id select transaction).FirstOrDefault();

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

            return(RedirectToPage("./Index"));
        }
        //Deletes a House.
        public IActionResult OnPost(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            House = (from house in _context.House where house.Id == id select house).FirstOrDefault();

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

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