public ActionResult AddUserReceiveAddress([DataSourceRequest] DataSourceRequest request, string consignee, string mobile, string tel, int currentCountyID, string address, int currentUserID)
        {
            var userReceiveAddressService = new UserReceiveAddressService();
            var model = new UserReceiveAddressModel
                            {
                                Consignee = consignee,
                                Mobile = mobile,
                                Tel = tel,
                                CountyID = currentCountyID,
                                UserID = currentUserID,
                                IsDefault = false,
                                Address = address
                            };
            var userReceiveAddress = DataTransfer.Transfer<User_RecieveAddress>(model, typeof(UserReceiveAddressModel));
            int addressId = userReceiveAddressService.Add(userReceiveAddress, null);
            model.ID = addressId;

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
 public ActionResult AddUser(UserModel userModel)
 {
     try
     {
         var orderService = new OrderService(this.SystemUserSession.EmployeeID);
         var user = new User
                        {
                            UserLevelID = 1,
                            Email = userModel.Email ?? userModel.Mobile,  // 优先使用邮箱作为登录用户名,其次使用手机号。
                            EmailValidate = false,
                            Name = userModel.Name,
                            LoginName = userModel.Email ?? "*****@*****.**", // 后台客户添加用户信息时,若用户没有邮箱,则设置默认值“[email protected]”
                            Mobile = userModel.Mobile,
                            MobileValidate = false,
                            Tel = userModel.Tel,
                            NickName = userModel.Name,
                            Address = userModel.Address,
                            LoginPassword = Encrypt.HashByMD5("123456"),  // 对会员密码进行加密
                            Birthday = null,
                            LastLoginTime = null,
                            Integral = 0,
                            Status = 1,
                            CreateTime = DateTime.Now,
                            CountyID = userModel.CountyID
                        };
         orderService.AddUserInfo(user);
         var addressModel = new UserReceiveAddressModel { CountyID = user.CountyID };
         return
             this.Json(
                 new AjaxResponse(
                     1,
                     new { UserID = user.ID, CountyId = user.CountyID, CountyInfo = addressModel.CountyName }));
         //this.Content(
         //    "{State:'Ok',UserID:'" + user.ID + "',CountyInfo:'" + addressModel.CountyName + "'}");
     }
     catch
     {
         return this.Content("{State:'Error'}");
     }
 }