Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ActionResult AddEditUser(int userId = 0)
        {
            //var datataaa = EmailDesigner.GetAccountActivationEmail("asd","IDSISSSSSSS");

            var userModel = new UserViewModel();


            var countryList = CountryList.GetCountryList();

            if (countryList.Any())
            {
                if (countryList.Count > 0)
                {
                    ViewBag.DropDownForCountry =
                        countryList.Select(c => new SerializableSelectListItem
                    {
                        Text  = c.CountryName,
                        Value = c.CountryId.ToString(CultureInfo.InvariantCulture)
                    });
                }
            }



            if (SessionManager.GetSessionInfo() != null && (SessionManager.IsAdminLoggedIn() || SessionManager.GetSessionInfo().Id == userId))
            {
                if (userId > 0)
                {
                    userModel = UserManager.GetUserById(userId);
                }

                if (userModel.Country != 0)
                {
                    ViewBag.StateInfo = StateList.GetStateByCountry(userModel.Country);
                }



                if (SessionManager.IsAdminLoggedIn())
                {
                    ViewBag.Roles = NewsIndiaBAL.RoleManager.GetRoles();
                }
            }
            else if (SessionManager.GetSessionInfo() != null)
            {
                return(RedirectToAction("Index", "Home"));
            }


            ViewBag.IsAddRequest = userModel.UserId == 0;

            return(View(userModel));
            //  return RedirectToAction("Index", "Home");
        }
Esempio n. 2
0
 public JsonResult GetStatesForCountry(int countryId)
 {
     try
     {
         return(Json(StateList.GetStateByCountry(countryId), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new StateInformation(), JsonRequestBehavior.AllowGet));
     }
 }