public static async Task AddDistributorAddress() { try { //Read inputs DistributorAddress distributorAddress = new DistributorAddress(); Write("AddressLine1: "); distributorAddress.AddressLine1 = ReadLine(); Write("AddressLine2: "); distributorAddress.AddressLine2 = ReadLine(); Write("City: "); distributorAddress.City = ReadLine(); Write("State: "); distributorAddress.State = ReadLine(); Write("Pincode: "); distributorAddress.PinCode = ReadLine(); //Invoke AddDistributorBL method to add using (IDistributorAddressBL distributorAddressBL = new DistributorAddressBL()) { bool isAdded = await distributorAddressBL.AddDistributorAddressBL(distributorAddress); if (isAdded) { WriteLine("Distributor Address Added"); } } } catch (Exception ex) { ExceptionLogger.LogException(ex); WriteLine(ex.Message); } }
private static void AddDistributorAddress() { try { DistributorAddress distributorAddress = new DistributorAddress(); Console.WriteLine("Enter Distributor Address ID :"); distributorAddress.DistributorAddressID = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter Distributor Address Line1 :"); distributorAddress.DistributorAddressLine1 = Console.ReadLine(); Console.WriteLine("Enter Distributor Address Line2 :"); distributorAddress.DistributorAddressLine2 = Console.ReadLine(); Console.WriteLine("Enter Distributor City :"); distributorAddress.DistributorCity = Console.ReadLine(); Console.WriteLine("Enter Distributor State :"); distributorAddress.DistributorState = Console.ReadLine(); Console.WriteLine("Enter Pincode :"); distributorAddress.DistributorPincode = Console.ReadLine(); bool distributorAddressAdded = DistributorAddressBL.AddDistributorAddressBL(distributorAddress); if (distributorAddressAdded) { Console.WriteLine("Distributor Address Added"); } else { Console.WriteLine("Distributor Address not Added"); } } catch (InventoryException ex) { Console.WriteLine(ex.Message); } }