コード例 #1
0
        public JsonResult SaveContact(string guid = "")
        {
            string realName     = Request["realName"].ToString();
            string company      = Request["company"].ToString();
            string position     = Request["position"].ToString();
            string phoneNum     = Request["phoneNum"].ToString();
            string faxNum       = Request["faxNum"].ToString();
            string postCode     = Request["postCode"].ToString();
            string address      = Request["address"].ToString();
            string customerGuid = Request["customerGuid"].ToString();

            if (string.IsNullOrWhiteSpace(guid))
            {
                string userName = Request["userName"].ToString();
                string password = Request["password"].ToString();
                _contactFactory.AddCcontact(userName, password, realName, company, position, phoneNum, faxNum, address, postCode, customerGuid);
            }
            else
            {
                var contact = ContactFactory.GetContact(guid);
                contact.RealName     = realName;
                contact.Company      = company;
                contact.Position     = position;
                contact.PhoneNum     = phoneNum;
                contact.FaxNum       = faxNum;
                contact.PostCode     = postCode;
                contact.Address      = address;
                contact.CustomerGuid = customerGuid;
                _contactFactory.SaveContact(contact);
            }

            return(Json(new { result = 1 }));
        }