public async Task <IHttpActionResult> GetPropertyPhoto(int id) { PropertyPhoto objct = await db.PropertyPhotos.FindAsync(id); if (objct == null) { return(NotFound()); } PropertyPhotoNoR newObject = new PropertyPhotoNoR() { Description = objct.Description, ImageID = objct.ImageID, PropertyId = objct.PropertyId, PropertyPhotoPath = objct.PropertyPhotoPath, // PropertyNoR = objct.PropertyNoR, Title = objct.Title }; return(Ok(newObject)); }
// GET: api/PropertyPhotoes public ICollection <PropertyPhotoNoR> GetPropertyPhotos() { List <PropertyPhotoNoR> Lys = new List <PropertyPhotoNoR>(); foreach (PropertyPhoto objct in db.PropertyPhotos.Include(p => p.Property)) { PropertyPhotoNoR newObject = new PropertyPhotoNoR() { Description = objct.Description, ImageID = objct.ImageID, PropertyId = objct.PropertyId, PropertyPhotoPath = objct.PropertyPhotoPath, // PropertyNoR = objct.PropertyNoR, Title = objct.Title }; Lys.Add(newObject); } return(Lys); }
public async Task <IHttpActionResult> GetProperty(int id) { Property objct = await db.Properties.FindAsync(id); if (objct == null) { return(NotFound()); } PropertyNoR newObject = new PropertyNoR() { BathRooms = objct.BathRooms, // AuctionRegistrations = objct.AuctionRegistrations, Auction = new AuctionNoR(), ApprovalStatus = objct.ApprovalStatus, Description = objct.Description, Jacquizzi = objct.Jacquizzi, PropertyID = objct.PropertyID, Address = objct.Address, levies = objct.levies, BedRooms = objct.BedRooms, Borehole = objct.Borehole, HOARules = objct.HOARules, OutdoorKitchen = objct.OutdoorKitchen, Braai = objct.Braai, City = objct.City, OpeningBid = objct.OpeningBid, // Seller=objct.Seller, Clubhouse = objct.Clubhouse, MandateExpireDate = objct.MandateExpireDate, SellerID = objct.SellerID, // ConcludedAuction = objct.ConcludedAuction, SellerSigniture = objct.SellerSigniture, SwimmingPool = objct.SwimmingPool, FloorSize = objct.FloorSize, MandateSingedDate = objct.MandateSingedDate, Country = objct.Country, YardSize = objct.YardSize, Fibre = objct.Fibre, TitleDeedPath = objct.TitleDeedPath, FireplacePit = objct.FireplacePit, Garages = objct.Garages, Garden = objct.Garden, Gerages = objct.Gerages, MandateType = objct.MandateType, Parking = objct.Parking, PlansPath = objct.PlansPath, PropertyType = objct.PropertyType, Province = objct.Province, RegistrationType = objct.RegistrationType, Reserve = objct.Reserve, TaxesAndRate = objct.TaxesAndRate, TaxesAndRates = objct.TaxesAndRates, TennisCourts = objct.TennisCourts, Terrace = objct.Terrace, Title = objct.Title }; foreach (PropertyPhoto pp in objct.PropertyPhotos) { PropertyPhotoNoR ppnr = new PropertyPhotoNoR(); ppnr.Description = pp.Description; ppnr.ImageID = pp.ImageID; ppnr.PropertyPhotoPath = pp.PropertyPhotoPath; ppnr.PropertyId = pp.ImageID; ppnr.Title = pp.Title; newObject.PropertyPhotos.Add(ppnr); } foreach (PromoVideo pp in objct.PromoVideos) { PromoVideoNoR ppnr = new PromoVideoNoR(); ppnr.PropertyID = pp.PropertyID; ppnr.VideoPath = pp.VideoPath; ppnr.VideoID = pp.VideoID; newObject.PromoVideos.Add(ppnr); } foreach (AuctionRegistration pp in objct.AuctionRegistrations) { AuctionRegistrationNoR ppnr = new AuctionRegistrationNoR(); ppnr.PropertyID = pp.PropertyID; try { ppnr.AdminFee = new AdminFeeNoR(); ppnr.AdminFee.Amount = pp.AdminFee.Amount; ppnr.AdminFee.DateOfPayment = pp.AdminFee.DateOfPayment; ppnr.AdminFee.PaymentID = pp.AdminFee.PaymentID; ppnr.AdminFee.ProofOfPaymentPath = pp.AdminFee.ProofOfPaymentPath; } catch { } try { ppnr.RegisteredBuyer = new RegisteredBuyerNoR(); ppnr.RegisteredBuyer.Deposit.Amount = pp.RegisteredBuyer.Deposit.Amount; ppnr.RegisteredBuyer.Deposit.BuyerID = pp.RegisteredBuyer.Deposit.BuyerID; ppnr.RegisteredBuyer.Deposit.DateOfPayment = pp.RegisteredBuyer.Deposit.DateOfPayment; ppnr.RegisteredBuyer.Deposit.DepositReturned = pp.RegisteredBuyer.Deposit.DepositReturned; ppnr.RegisteredBuyer.Deposit.ProofOfPaymentPath = pp.RegisteredBuyer.Deposit.ProofOfPaymentPath; ppnr.RegisteredBuyer.Deposit.ProofOfReturnPayment = pp.RegisteredBuyer.Deposit.ProofOfReturnPayment; } catch { } try { ppnr.BankApproval = new BankApprovalNoR(); ppnr.BankApproval.ApprovalPath = pp.BankApproval.ApprovalPath; ppnr.BankApproval.BankApprovalApprovalstatus = pp.BankApproval.BankApprovalApprovalstatus; ppnr.BankApproval.DateOfSubmision = pp.BankApproval.DateOfSubmision; } catch { } try { ppnr.Guarintee = new GuarinteeNoR(); ppnr.Guarintee.AuctionRegistrationID = pp.Guarintee.AuctionRegistrationID; ppnr.Guarintee.DateOfSubmition = pp.Guarintee.DateOfSubmition; ppnr.Guarintee.GuarinteeApproval = pp.Guarintee.GuarinteeApproval; ppnr.Guarintee.GuarinteePath = pp.Guarintee.GuarinteePath; } catch { } ppnr.id = pp.id; ppnr.Bonded = pp.Bonded; ppnr.BuyerId = pp.BuyerId; ppnr.RegesterDate = pp.RegesterDate; ppnr.RegistrationFees = pp.RegistrationFees; ppnr.RegistrationStatus = pp.RegistrationStatus; newObject.AuctionRegistrations.Add(ppnr); } try { newObject.Auction.PropertyID = objct.Auction.PropertyID; newObject.Auction.StartTime = objct.Auction.StartTime; newObject.Auction.EndTime = objct.Auction.EndTime; } catch { } try { newObject.Seller = new SellerNoR(); newObject.Seller.FirtstName = objct.Seller.FirtstName; newObject.Seller.ApprovalStatus = objct.Seller.ApprovalStatus; newObject.Seller.LastName = objct.Seller.LastName; newObject.Seller.ProfilePhoto = objct.Seller.ProfilePhoto; newObject.Seller.SellerNumber = objct.Seller.SellerNumber; newObject.Seller.SellerEmail = objct.Seller.SellerEmail; newObject.Seller.SellerType = objct.Seller.SellerType; newObject.Seller.Signature = objct.Seller.Signature; newObject.Seller.UserID = objct.Seller.UserID; } catch { } try { if (objct.Seller.Retailer != null) { newObject.Seller.Retailer = new RetailerNoR(); newObject.Seller.Retailer.Branch = objct.Seller.Retailer.Branch; newObject.Seller.Retailer.CompanyContactNumber = objct.Seller.Retailer.CompanyContactNumber; newObject.Seller.Retailer.CompanyEmail = objct.Seller.Retailer.CompanyEmail; newObject.Seller.Retailer.CompaynLogoPath = objct.Seller.Retailer.CompaynLogoPath; newObject.Seller.Retailer.RetailerName = objct.Seller.Retailer.RetailerName; newObject.Seller.Retailer.UserID = objct.Seller.Retailer.UserID; newObject.Seller.Retailer.CompanyDescription = objct.Seller.Retailer.CompanyDescription; } } catch { } try { if (objct.Seller.Auctioneer != null) { newObject.Seller.Auctioneer = new AuctioneerNoR(); newObject.Seller.Auctioneer.Branch = objct.Seller.Auctioneer.Branch; newObject.Seller.Auctioneer.CompanyContactNumber = objct.Seller.Auctioneer.CompanyContactNumber; newObject.Seller.Auctioneer.CompanyEmail = objct.Seller.Auctioneer.CompanyEmail; newObject.Seller.Auctioneer.CompanyLogo = objct.Seller.Auctioneer.CompanyLogo; newObject.Seller.Auctioneer.CompanyName = objct.Seller.Auctioneer.CompanyName; newObject.Seller.Auctioneer.UserID = objct.Seller.Auctioneer.UserID; newObject.Seller.Auctioneer.CompanyDescriprion = objct.Seller.Auctioneer.CompanyDescriprion; } } catch { } try { if (objct.Seller.PrivateSeller != null) { newObject.Seller.PrivateSeller = new PrivateSellerNoR(); newObject.Seller.PrivateSeller.UserID = objct.Seller.PrivateSeller.UserID; newObject.Seller.PrivateSeller.Signiture = objct.Seller.Auctioneer.Signature; newObject.Seller.PrivateSeller.IDNumber = objct.Seller.PrivateSeller.IDNumber; newObject.Seller.PrivateSeller.ProofOfResedence = objct.Seller.PrivateSeller.ProofOfResedence; } } catch { } try { if (objct.ConcludedAuction != null) { newObject.ConcludedAuction = new ConcludedAuctionNoR(); newObject.ConcludedAuction.WinningBidder = objct.ConcludedAuction.WinningBidder; newObject.ConcludedAuction.TimeOfConclution = objct.ConcludedAuction.TimeOfConclution; newObject.ConcludedAuction.PropertyID = objct.ConcludedAuction.PropertyID; newObject.ConcludedAuction.ExceededReserve = objct.ConcludedAuction.ExceededReserve; } } catch { } return(Ok(newObject)); }
public async Task <IHttpActionResult> GetSeller(string id) { Seller objct = await db.Sellers.FindAsync(id); if (objct == null) { return(NotFound()); } SellerNoR newObject = new SellerNoR() { UserID = objct.UserID, Signature = objct.Signature, ApprovalStatus = objct.ApprovalStatus, // Auctioneer = objct.Auctioneer, FirtstName = objct.FirtstName, LastName = objct.LastName, // PrivateSeller= objct.PrivateSeller, SellerNumber = objct.SellerNumber, ProfilePhoto = objct.ProfilePhoto, // Properties = objct.Properties, // Retailer = objct.Retailer, // SellerAddresses = objct.SellerAddresses, SellerEmail = objct.SellerEmail, SellerType = objct.SellerType }; try { newObject.Retailer = new RetailerNoR(); newObject.Retailer.Branch = objct.Retailer.Branch; newObject.Retailer.CompanyContactNumber = objct.Retailer.CompanyContactNumber; newObject.Retailer.CompanyEmail = objct.Retailer.CompanyEmail; newObject.Retailer.CompaynLogoPath = objct.Retailer.CompaynLogoPath; newObject.Retailer.RetailerName = objct.Retailer.RetailerName; newObject.Retailer.UserID = objct.Retailer.UserID; newObject.Retailer.CompanyDescription = objct.Retailer.CompanyDescription; } catch { } try { newObject.Auctioneer = new AuctioneerNoR(); newObject.Auctioneer.Branch = objct.Auctioneer.Branch; newObject.Auctioneer.CompanyContactNumber = objct.Auctioneer.CompanyContactNumber; newObject.Auctioneer.CompanyEmail = objct.Auctioneer.CompanyEmail; newObject.Auctioneer.CompanyLogo = objct.Auctioneer.CompanyLogo; newObject.Auctioneer.CompanyName = objct.Auctioneer.CompanyName; newObject.Auctioneer.UserID = objct.Auctioneer.UserID; newObject.Auctioneer.CompanyDescriprion = objct.Auctioneer.CompanyDescriprion; } catch { } try { newObject.PrivateSeller = new PrivateSellerNoR(); newObject.PrivateSeller.UserID = objct.PrivateSeller.UserID; newObject.PrivateSeller.Signiture = objct.Auctioneer.Signature; newObject.PrivateSeller.IDNumber = objct.PrivateSeller.IDNumber; newObject.PrivateSeller.ProofOfResedence = objct.PrivateSeller.ProofOfResedence; } catch { } List <PropertyNoR> lys = new List <PropertyNoR>(); foreach (Property pop in objct.Properties) { try { PropertyNoR newprop = new PropertyNoR() { BathRooms = pop.BathRooms, // AuctionRegistrations = objct.AuctionRegistrations, Auction = new AuctionNoR(), ApprovalStatus = pop.ApprovalStatus, Description = pop.Description, Jacquizzi = pop.Jacquizzi, PropertyID = pop.PropertyID, Address = pop.Address, levies = pop.levies, BedRooms = pop.BedRooms, Borehole = pop.Borehole, HOARules = pop.HOARules, OutdoorKitchen = pop.OutdoorKitchen, Braai = pop.Braai, City = pop.City, OpeningBid = pop.OpeningBid, // Seller=objct.Seller, Clubhouse = pop.Clubhouse, MandateExpireDate = pop.MandateExpireDate, SellerID = pop.SellerID, // ConcludedAuction = objct.ConcludedAuction, SellerSigniture = pop.SellerSigniture, SwimmingPool = pop.SwimmingPool, FloorSize = pop.FloorSize, MandateSingedDate = pop.MandateSingedDate, Country = pop.Country, YardSize = pop.YardSize, Fibre = pop.Fibre, TitleDeedPath = pop.TitleDeedPath, FireplacePit = pop.FireplacePit, Garages = pop.Garages, Garden = pop.Garden, Gerages = pop.Gerages, MandateType = pop.MandateType, Parking = pop.Parking, PlansPath = pop.PlansPath, PropertyType = pop.PropertyType, Province = pop.Province, RegistrationType = pop.RegistrationType, Reserve = pop.Reserve, TaxesAndRate = pop.TaxesAndRate, TaxesAndRates = pop.TaxesAndRates, TennisCourts = pop.TennisCourts, Terrace = pop.Terrace, Title = pop.Title }; if (pop.PropertyPhotos.Count != 0) { foreach (PropertyPhoto pp in pop.PropertyPhotos) { PropertyPhotoNoR ppnr = new PropertyPhotoNoR(); ppnr.Description = pp.Description; ppnr.ImageID = pp.ImageID; ppnr.PropertyPhotoPath = pp.PropertyPhotoPath; ppnr.PropertyId = pp.ImageID; ppnr.Title = pp.Title; newprop.PropertyPhotos.Add(ppnr); } } if (pop.PromoVideos.Count != 0) { foreach (PromoVideo pp in pop.PromoVideos) { PromoVideoNoR ppnr = new PromoVideoNoR(); ppnr.PropertyID = pp.PropertyID; ppnr.VideoPath = pp.VideoPath; ppnr.VideoID = pp.VideoID; newprop.PromoVideos.Add(ppnr); } } lys.Add(newprop); } catch { } newObject.Properties = lys; try { List <SellerAddressNoR> lysAdd = new List <SellerAddressNoR>(); foreach (SellerAddress bAdd in objct.SellerAddresses) { SellerAddressNoR newAdd = new SellerAddressNoR(); newAdd.AddressID = bAdd.Address.AddressID; newAdd.id = bAdd.id; newAdd.UserID = bAdd.UserID; lysAdd.Add(newAdd); } newObject.SellerAddresses = lysAdd; } catch { } } return(Ok(newObject)); }