public CustomerModels GetDetail(string id)
 {
     try
     {
         CustomerModels model = _factory.GetDetailCustomer(id);
         model.Password        = CommonHelper.Decrypt(model.Password);
         model.ConfirmPassword = model.Password;
         return(model);
     }
     catch (Exception ex)
     {
         NSLog.Logger.Error("GetDetailCustomer: ", ex);
         return(null);
     }
 }
        public ActionResult SignUp(CustomerModels model)
        {
            try
            {
                if (!string.IsNullOrEmpty(model.Password) && !string.IsNullOrEmpty(model.ConfirmPassword) && !model.Password.Equals(model.ConfirmPassword))
                {
                    ModelState.AddModelError("ConfirmPassword", "Xác nhận mật khẩu không chính xác !");
                }

                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                model.Password = CommonHelper.Encrypt(model.Password);
                string msg    = "";
                string cusId  = "";
                var    result = _factory.InsertCustomer(model, ref msg, ref cusId);
                if (result)
                {
                    var         data        = _factory.GetDetailCustomer(cusId);
                    UserSession userSession = new UserSession();
                    userSession.Email    = data.Email;
                    userSession.UserName = data.Name;
                    Session.Add("UserClient", userSession);
                    string     myObjectJson = JsonConvert.SerializeObject(userSession); //new JavaScriptSerializer().Serialize(userSession);
                    HttpCookie cookie       = new HttpCookie("UserClientCookie");
                    cookie.Expires = DateTime.Now.AddMonths(1);
                    cookie.Value   = Server.UrlEncode(myObjectJson);
                    HttpContext.Response.Cookies.Add(cookie);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("Email", msg);
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("SignUp", ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }