public async Task <IHttpActionResult> GetBuyerAddress(int id)
        {
            BuyerAddress objct = await db.BuyerAddresses.FindAsync(id);

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

            BuyerAddressNoR newObject = new BuyerAddressNoR()
            {
                // Bids= objct.Bids,
                //  BankApproval = objct.BankApproval,
                AddressID = objct.AddressID,
                id        = objct.id,
                //  Guarintee = objct.Guarintee,
                //  Auction = objct.Auction,
                //  Property = objct.Property,
                // RegisteredBuyer = objct.RegisteredBuyer,
                UserID = objct.UserID,
                //  ConcludedAuctions = objct.ConcludedAuctions,
                //   PropertyID = objct.PropertyID,
                // RegisteredBuyer = objct.RegisteredBuyer,
                // TimeOfbid = objct.TimeOfbid
                //Seller = objct.Seller
                // AuctionRegistration = fee.AuctionRegistration
            };

            return(Ok(newObject));
        }
        // GET: api/BuyerAddresses
        public ICollection <BuyerAddressNoR> GetBuyerAddresses()
        {
            List <BuyerAddressNoR> Lys = new List <BuyerAddressNoR>();

            foreach (BuyerAddress objct in db.BuyerAddresses.Include(b => b.Address).Include(b => b.RegisteredBuyer))
            {
                BuyerAddressNoR newObject = new BuyerAddressNoR()
                {
                    // Bids= objct.Bids,
                    //  BankApproval = objct.BankApproval,
                    AddressID = objct.AddressID,
                    id        = objct.id,
                    //  Guarintee = objct.Guarintee,
                    //  Auction = objct.Auction,
                    //  Property = objct.Property,
                    // RegisteredBuyer = objct.RegisteredBuyer,
                    UserID = objct.UserID,
                    //  ConcludedAuctions = objct.ConcludedAuctions,
                    //   PropertyID = objct.PropertyID,
                    // RegisteredBuyer = objct.RegisteredBuyer,
                    // TimeOfbid = objct.TimeOfbid
                    //Seller = objct.Seller
                    // AuctionRegistration = fee.AuctionRegistration
                };


                Lys.Add(newObject);
            }

            return(Lys);
        }
        public async Task <IHttpActionResult> GetRegisteredBuyer(string id)
        {
            RegisteredBuyer objct = await db.RegisteredBuyers.FindAsync(id);

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


            RegisteredBuyerNoR newObject = new RegisteredBuyerNoR()
            {
                ApprovalStatus = objct.ApprovalStatus,
                // Deposit = objct.Deposit,
                // AuctionRegistrations = objct.AuctionRegistrations,
                // Bids = objct.Bids,
                //  BuyerAddresses = objct.BuyerAddresses,
                FirstName = objct.FirstName,
                // ConcludedAuctions = objct.ConcludedAuctions,
                Signiture = objct.Signiture,
                //  CopyOfIDPath = objct.DateOfBirth,
                DateOfBirth          = objct.DateOfBirth,
                IDBuyerVerifyPhoto   = objct.IDBuyerVerifyPhoto,
                LastName             = objct.LastName,
                IDNumber             = objct.IDNumber,
                ProfilePhotoPath     = objct.ProfilePhotoPath,
                ProofOfBankAccount   = objct.ProofOfBankAccount,
                ProofOfResidencePath = objct.ProofOfResidencePath,
                UserId           = objct.UserId,
                RegistrationDate = objct.RegistrationDate
            };

            try
            {
                DepositNoR newDep = new DepositNoR();
                newDep.Amount               = objct.Deposit.Amount;
                newDep.BuyerID              = objct.Deposit.BuyerID;
                newDep.DateOfPayment        = objct.Deposit.DateOfPayment;
                newDep.DepositReturned      = objct.Deposit.DepositReturned;
                newDep.ProofOfPaymentPath   = objct.Deposit.ProofOfPaymentPath;
                newDep.ProofOfReturnPayment = objct.Deposit.ProofOfReturnPayment;


                newObject.Deposit = newDep;
            }
            catch { }

            try
            {
                List <BuyerAddressNoR> lys = new List <BuyerAddressNoR>();

                foreach (BuyerAddress bAdd in objct.BuyerAddresses)
                {
                    BuyerAddressNoR newAdd = new BuyerAddressNoR();
                    newAdd.AddressID = bAdd.Address.AddressID;
                    newAdd.id        = bAdd.id;
                    newAdd.UserID    = bAdd.UserID;

                    lys.Add(newAdd);
                }
                newObject.BuyerAddresses = lys;
            }
            catch
            {
            }

            return(Ok(newObject));
        }
        // GET: api/RegisteredBuyers
        public ICollection <RegisteredBuyerNoR> GetRegisteredBuyers()
        {
            List <RegisteredBuyerNoR> Lys = new List <RegisteredBuyerNoR>();

            foreach (RegisteredBuyer objct in db.RegisteredBuyers.Include(r => r.Deposit))
            {
                RegisteredBuyerNoR newObject = new RegisteredBuyerNoR()
                {
                    ApprovalStatus = objct.ApprovalStatus,
                    // Deposit = objct.Deposit,
                    // AuctionRegistrations = objct.AuctionRegistrations,
                    // Bids = objct.Bids,
                    //  BuyerAddresses = objct.BuyerAddresses,
                    FirstName = objct.FirstName,
                    // ConcludedAuctions = objct.ConcludedAuctions,
                    Signiture = objct.Signiture,
                    //  CopyOfIDPath = objct.DateOfBirth,
                    DateOfBirth          = objct.DateOfBirth,
                    IDBuyerVerifyPhoto   = objct.IDBuyerVerifyPhoto,
                    LastName             = objct.LastName,
                    IDNumber             = objct.IDNumber,
                    ProfilePhotoPath     = objct.ProfilePhotoPath,
                    ProofOfBankAccount   = objct.ProofOfBankAccount,
                    ProofOfResidencePath = objct.ProofOfResidencePath,
                    UserId           = objct.UserId,
                    RegistrationDate = objct.RegistrationDate
                };
                try
                {
                    DepositNoR newDep = new DepositNoR();
                    newDep.Amount               = objct.Deposit.Amount;
                    newDep.BuyerID              = objct.Deposit.BuyerID;
                    newDep.DateOfPayment        = objct.Deposit.DateOfPayment;
                    newDep.DepositReturned      = objct.Deposit.DepositReturned;
                    newDep.ProofOfPaymentPath   = objct.Deposit.ProofOfPaymentPath;
                    newDep.ProofOfReturnPayment = objct.Deposit.ProofOfReturnPayment;

                    newObject.Deposit = newDep;
                }
                catch { }

                try
                {
                    List <BuyerAddressNoR> lys = new List <BuyerAddressNoR>();

                    foreach (BuyerAddress bAdd in objct.BuyerAddresses)
                    {
                        BuyerAddressNoR newAdd = new BuyerAddressNoR();
                        newAdd.AddressID = bAdd.Address.AddressID;
                        newAdd.id        = bAdd.id;
                        newAdd.UserID    = bAdd.UserID;

                        lys.Add(newAdd);
                    }
                    newObject.BuyerAddresses = lys;
                }
                catch
                {
                }


                Lys.Add(newObject);
            }

            return(Lys);
        }