public tin tinCode() { IList <Param> sList = vResponse.Param; for (int i = 0; i < sList.Count; i++) { if (sList[i].key.Equals("name")) { name = sList[i].value; } if (sList[i].key.Equals("phone")) { phone = sList[i].value; } if (sList[i].key.Equals("address")) { address = sList[i].value; } if (sList[i].key.Equals("email")) { email = sList[i].value; } } tin tinParam = new tin(); tinParam.name = name; tinParam.phone = phone; tinParam.address = address; tinParam.email = email; var tinRecord = db.tins.Add(tinParam); db.SaveChanges(); //Console.WriteLine(tinRecord); return(tinRecord); }
//returning tin param public IList <Param> TinParamArray(tin tin) { Dictionary <string, string> Result = new Dictionary <string, string>(); IList <Param> tinParam = new List <Param>(); Result.Add("nama", tin.name); Result.Add("phone", tin.phone); Result.Add("email", tin.email); Result.Add("address", tin.address); foreach (var item in Result) { Param p = new Param(); p.key = item.Key; p.value = item.Value; tinParam.Add(p); } return(tinParam); }