コード例 #1
0
        public ActionResult UpdateProfileView(UpdateModel data, FormCollection val)
        {
            int user;

            try
            {
                if (ModelState.IsValid)
                {
                    string encryptedPassword = BrokerUtility.EncryptURL(data.Password);
                    int?   state             = data.StateId;
                    int?   country           = data.CountryId;
                    user = BrokerUtility.UpdateUser(Session["UserId"].ToString(), encryptedPassword, data.Address, data.City, state, country, data.PinCode, data.MobNo, "1", data.UserType, "1");
                    if (user > 0)
                    {
                        CreateLoginIdentity(data.FirstName + ' ' + data.LastName, Convert.ToInt32(Session["UserId"].ToString()));
                        return(RedirectToAction("Index", "Home"));
                    }

                    else
                    {
                        ViewBag.UserExist = "Error occured while updating your profile.";
                    }
                }
                else
                {
                    ViewBag.validateerror = "Please validate all input";
                }
            }
            catch (Exception ex)
            {
                BrokerUtility.ErrorLog(Convert.ToInt32(Session["UserId"].ToString()), "UpdateProfileView", ex.Message.ToString(), "HomeController.cs_UpdateProfileView()", BrokerUtility.GetIPAddress(Session["UserId"].ToString()));
            }
            return(View(data));

            //return View(model);
        }