// See above. Vice versa. public ServiceRefAuction.Auction ConvertToServiceAuction(ModelLayer.Auction desktopAuction) { ServiceRefAuction.Auction serviceAuction = null; if (desktopAuction != null) { serviceAuction = new ServiceRefAuction.Auction { AuctionId = desktopAuction.AuctionId, TimeLeft = desktopAuction.TimeLeft, Payment = desktopAuction.Payment, Result = desktopAuction.Result, PaymentDate = desktopAuction.PaymentDate, ProductName = desktopAuction.ProductName, ProductDescription = desktopAuction.ProductDescription, }; } return(serviceAuction); }
// Convert Auction-object created through service to local Auction-object in desktop app. public ModelLayer.Auction ConvertFromServiceAuction(ServiceRefAuction.Auction serviceAuction) { ModelLayer.Auction desktopAuction = null; if (serviceAuction != null) { desktopAuction = new ModelLayer.Auction { AuctionId = serviceAuction.AuctionId, TimeLeft = serviceAuction.TimeLeft, Payment = serviceAuction.Payment, Result = serviceAuction.Result, PaymentDate = serviceAuction.PaymentDate, ProductName = serviceAuction.ProductName, ProductDescription = serviceAuction.ProductDescription, }; } return(desktopAuction); }