Beispiel #1
0
 M_BillingAddress ICustomer.AddNewAddress(M_BillingAddress address)
 {
     try
     {
         return(icustomer.AddNewAddress(address));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Beispiel #2
0
        M_BillingAddress ICustomerDA.AddNewAddress(M_BillingAddress address)
        {
            //M_BillingAddress result = new M_BillingAddress();
            try
            {
                DataTable dt = new DataTable();
                if (connString.State == ConnectionState.Closed)
                {
                    connString.Open();
                }
                cmd             = new SqlCommand("uspInsertUpdateAddress", connString);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@CustomerId", address.CustomerId);
                cmd.Parameters.AddWithValue("@BillingAddressId", address.BillingAddressId);
                cmd.Parameters.AddWithValue("@Name", address.Name);
                cmd.Parameters.AddWithValue("@Address1", address.Address1);
                cmd.Parameters.AddWithValue("@Address2", address.Address2);
                cmd.Parameters.AddWithValue("@LandMark", address.LandMark);
                cmd.Parameters.AddWithValue("@ContactNo", address.ContactNo);
                cmd.Parameters.AddWithValue("@Pincode", address.Pincode);
                cmd.Parameters.AddWithValue("@StateId", address.StateId);
                cmd.Parameters.AddWithValue("@CountryId", address.CountryId);
                cmd.Parameters.AddWithValue("@Latitude", address.Latitude);
                cmd.Parameters.AddWithValue("@Longitude", address.Longitude);
                cmd.Parameters.AddWithValue("@AddressType", address.AddressType);
                cmd.Parameters.AddWithValue("@IsDefault", address.IsDefault);

                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);
                sda.Dispose();
                return(ExtensionMethods.ConvertToListOf <M_BillingAddress>(dt).FirstOrDefault());
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                connString.Close();
            }
        }
Beispiel #3
0
        public async Task <HttpResponseMessage> AddCustomerAddress([FromBody] M_BillingAddress address)
        {
            try
            {
                M_BillingAddress customer = new OnlineShop.Model.M_BillingAddress();
                await Task.Run(() =>
                {
                    customer = icustomer.AddNewAddress(address);
                });

                if (customer != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, customer));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, new { StatusCode = HttpStatusCode.NotFound, Status = "Failed" }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }