public JsonResult SaveCustomer(string guid = "") { string companyName = Request["companyName"].ToString(); string address = Request["address"].ToString(); string phoneNum = Request["phoneNum"].ToString(); string faxNum = Request["faxNum"].ToString(); string postCode = Request["postCode"].ToString(); if (string.IsNullOrWhiteSpace(guid)) { _customerFactory.AddCustomer(companyName, address, phoneNum, faxNum, postCode); } else { var customer = _customerFactory.GetCustomer(guid); customer.CompanyName = companyName; customer.PhoneNum = phoneNum; customer.FaxNum = faxNum; customer.Address = address; customer.PostCode = postCode; _customerFactory.SaveCustomer(customer); } return(Json(new { result = 1 })); }