Esempio n. 1
0
        public ActionResult EditProfile()
        {
            CommonBL commonBL = new CommonBL();
            CommunityBL CommunityBL = new BL.BusinessLayer.CommunityBL();
            CountryBL CountryBL = new BL.BusinessLayer.CountryBL();
            StateBL StateBL = new BL.BusinessLayer.StateBL();
            CityBL CityBL = new BL.BusinessLayer.CityBL();
            ProfileModel Model = new ProfileModel();

            List<IndustryBM> IndustryList = commonBL.GetIndustry();
            Model.SucessMessage = (TempData["Success"] != null ? TempData["Success"].ToString() : string.Empty).ToString();
            Model.ErrorMessage = (TempData["Error"] != null ? TempData["Error"].ToString() : string.Empty).ToString();

            if (SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User) != null)
            {

                UserBM CurrentUser = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User);
                Model.UserBM = CurrentUser;
                ViewBag.CurrentUser = CurrentUser.Name;
                List<UserGeneralInformationBM> GenerealInfoList = UserGeneralInformationBL.GetGeneralInformation().Where(p => p.UserId == CurrentUser.Id).ToList();
                if (GenerealInfoList.Count > 0)
                    Model.UserGeneralInformationModel = GenerealInfoList.FirstOrDefault();
                if (Model.UserGeneralInformationModel == null)
                    Model.UserGeneralInformationModel = new UserGeneralInformationBM();

                List<UserVideoBM> UserVideoList = UserVideoBL.GetUserVideo().Where(p => p.UserId == CurrentUser.Id).ToList();
                if (UserVideoList.Count > 0)
                    Model.UserVideoModel = UserVideoList.FirstOrDefault();
                if (Model.UserVideoModel == null)
                    Model.UserVideoModel = new UserVideoBM();

                //List<UserPersonalInformationBM> PersoalInfoList = UserPersonalInformationBL.GetPersonalInformation().Where(p => p.UserId == CurrentUser.Id).ToList();
                //if (PersoalInfoList.Count > 0)
                //    Model.UserPersonalInformationModel = PersoalInfoList.FirstOrDefault();
                //if (Model.UserPersonalInformationModel == null)
                //    Model.UserPersonalInformationModel = new UserPersonalInformationBM();

                Model.CommunityList = CommunityBL.GetCommunity().Where(o => o.ParentId == 0).ToList();

                Model.SubCommunityList = CommunityBL.GetCommunity().Where(o => o.ParentId != 0).ToList();
                Model.CountryList = CountryBL.GetCountry();
                Model.StateList = StateBL.GetState();
                Model.CityList = CityBL.GetCities();

                return View(Model);
            }
            return RedirectToAction("Login");
        }