Esempio n. 1
0
        public void ShouldCreateListing()
        {
            //Arrange
            Listing lst = new Listing();
            lst.RealEstateProperties = new List<RealEstateProperty>
            {
              new RealEstateProperty{Customer = new Customer
              {
                  FirstName = "Rennish", LastName = "Joseph", Email = "*****@*****.**", Phone = "4078964523" },
                  Address  = new PropertyAddress{Address1 = "123 Mainstareet",PostalCode = "686016",Address2 = "Orlando"},
                  PropertyType = PropertyType.PlotWithoutHouse,
                  SalePrice = 123456.90m
              }
            };

            //Act

            //Assert
            new ListingLogic().ListingCreate(lst);
        }
Esempio n. 2
0
 public async Task ListingCreate(Listing lst)
 {
     try
     {
         using (IRealEstateTransaction tran = await RealEstateDB.OpenWithTransactionAsAsync<IRealEstateTransaction>())
         {
             if (lst != null && !lst.RealEstateProperties.IsNullOrEmpty())
             {
                 foreach (var listing in lst.RealEstateProperties)
                 {
                     int custId = await tran.CustomerCreateAsync(listing.Customer);
                     listing.Address.CustomerId = custId;
                     await tran.PropertyAddressCreateAsync(listing.Address);
                 }
                 tran.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(string.Format("Error saving customer/Address infor for customerId:{0}", lst.RealEstateProperties[0].Customer.CustomerId), ex);
         throw;
     }
 }
Esempio n. 3
0
 public async Task ListingCreate(Listing lst)
 {
 }
Esempio n. 4
0
 public async Task ListingCreate(Listing lst)
 {
     await ListingDAL.ListingCreate(lst);
 }