コード例 #1
0
        /// <summary>
        /// Adds Address
        /// </summary>
        /// <returns></returns>
        public static async Task AddAddress()
        {
            try
            {
                //Read inputs
                Address    address    = new Address();
                CustomerBL CustomerBL = new CustomerBL();
                Customer   Customer   = await CustomerBL.GetCustomerByEmailBL(CommonData.CurrentUser.Email);

                address.CustomerID = Customer.CustomerID;
                Write("Address Line 1: ");
                address.AddressLine1 = ReadLine();
                Write("Address Line 2: ");
                address.AddressLine2 = ReadLine();
                Write("LandMark: ");
                address.Landmark = ReadLine();
                Write("City: ");
                address.City = ReadLine();
                Write("State: ");
                address.State = ReadLine();
                Write("PinCode: ");
                address.PinCode = ReadLine();
                //Invoke AddAddressBL method to add
                using (AddressBL addressBL = new AddressBL())
                {
                    bool isAdded = await addressBL.AddAddressBL(address);

                    if (isAdded)
                    {
                        WriteLine("Address Added");
                    }
                    WriteLine("Do you want to serailize:Y/N");

                    string confirmation = ReadLine();

                    if (confirmation.Equals("Y", StringComparison.OrdinalIgnoreCase))
                    {
                        addressBL.Serialize();
                    }
                }
            }
            catch (System.Exception ex)
            {
                ExceptionLogger.LogException(ex);
                WriteLine(ex.Message);
            }
        }