public ActionResult Profile()
        {
            UserProfileModel objUserProfile = new UserProfileModel();

            //_repoFile.GetList(x=>x.
            if (CurrentRole != "Administrator")
            {
                var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
                if (objProfile != null)
                {
                    ViewBag.DisciplineId = new SelectList(_repoDiscipline.GetList(x => x.CategoryId == objProfile.CategoryId).ToList(), "Id", "DisciplineName", objProfile.DisciplineId);
                    ViewBag.ProvinceId   = new SelectList(_repoProvince.GetList(x => x.Country == objProfile.CountryName).ToList(), "Id", "Name_1", objProfile.StateId);

                    objUserProfile       = UserProfileMap.Map(objProfile);
                    objUserProfile.IsNew = false;

                    var objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == objProfile.Id && x.SectionId == 1);
                    if (objEntityFile != null)
                    {
                        objUserProfile.FileId = objEntityFile.FileId.GetValueOrDefault();
                    }
                }
                else
                {
                    objUserProfile.IsNew = true;
                }
            }
            else
            {
                var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
                if (objProfile == null) ////This condition is to check if user has a profile or not
                {
                    objUserProfile.IsNew = true;
                }
                List <UserProfileModel> lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.StatusId == 0).ToList());
                ViewBag.TotalUserList = lstUserProfile.Count;
            }


            ViewBag.CurrentMainTab     = "Home";
            ViewBag.CurrentSubTab      = "ControlPanel";
            ViewBag.CurrentSuperSubTab = "Profile";

            ProfileSearchModel objProfileSearch = new ProfileSearchModel();

            objUserProfile.ProfileSearch = objProfileSearch;

            return(View(objUserProfile));
        }
Beispiel #2
0
        public ActionResult AjaxGetDisciplines(int id)
        {
            DisciplineModel[] arrDisciplines = DisciplineMap.Map(_repDiscipline.GetList(x => x.CategoryId == id && x.LanguageId == CurrentLanguage.Id).ToList()).ToArray();

            if (arrDisciplines != null)
            {
                return(Json(new { status = "success", disciplineList = arrDisciplines }));
            }
            else
            {
                return(Json(new { status = "error" }));
            }
        }
Beispiel #3
0
        private void PopulateViewBags()
        {
            //Countries and Provinces
            List <CountryModel> lstCountries = new List <CountryModel>();

            lstCountries.Add(new CountryModel
            {
                Id   = 1111,
                Name = "Country"
            }
                             );


            lstCountries.AddRange(CountryMap.Map(_repoCountry.GetList().ToList()));

            ViewBag.Countries = new SelectList(lstCountries, "Name", "Name");

            List <ProvinceModel> lstProvinces = new List <ProvinceModel>();

            lstProvinces.Add(new ProvinceModel
            {
                Id   = 0,
                Name = "State"
            });

            ViewBag.Provinces = new SelectList(lstProvinces, "Id", "Name");

            List <YearModel> lstYears = new List <YearModel>();


            List <DisciplineModel> lstDisciplines = new List <DisciplineModel>();

            lstDisciplines.Add(new DisciplineModel
            {
                Id             = 1111,
                DisciplineName = "Discipline",
                LanguageId     = CurrentLanguage.Id
            });

            lstDisciplines.AddRange(DisciplineMap.Map(_repoDiscipline.GetList(x => x.LanguageId == CurrentLanguage.Id).ToList()));

            ViewBag.Disciplines = new SelectList(lstDisciplines, "Id", "DisciplineName");

            List <SortByModel> lstSort = new List <SortByModel>();

            lstSort.Add(new SortByModel
            {
                Id      = 0,
                OrderBy = "Sort By"
            }

                        );

            lstSort.Add(new SortByModel
            {
                Id      = 1,
                OrderBy = "Ascending"
            });

            lstSort.Add(new SortByModel
            {
                Id      = 2,
                OrderBy = "Descending"
            });

            ViewBag.SortBy = new SelectList(lstSort, "Id", "OrderBy");
        }
Beispiel #4
0
 /// <summary>
 /// Получает список дисциплин.
 /// </summary>
 public List <DisciplineItem> GetList()
 {
     return(_disciplineRepository.GetList());
 }