Wednesday, June 7, 2017

how to pass a javascript object to be written to a database

I have an Address object from my user interface like below

Address:{address1:"Franklin",address2:"Warrensburg",adress3:"Missouri}

so as i am sending an object i should be able to capture all the fields.

so i define a class as

public class Address
    {
        public string Address1 { get; set; }
        public string Address2 { get; set; }
        public string Address3 { get; set; }
    }

and now when we get an object ,we get values as follows

["Address"] = new JObject
                {
                    ["Address1"] = _customer.Address.Address1, ===>Franklin
                    ["Address2"]= _customer.Address.Address2, ===>Warrensburg
                    ["Address3"] = _customer.Address.Address3 ===> Missouri
                }

No comments:

Post a Comment

Call a function in child component from parent component in React

Consider the following parent component class Parent extends React.Component { constructor(props) { super(props);         thi...