コード例 #1
0
        public ActionResult ViewGroup(long?id)
        {
            GroupModel objGroup = new GroupModel();

            objGroup = GroupMap.Map(_repoGroup.GetSingle(x => x.Id == id));
            ViewBag.CurrentMainTab     = "Front";
            ViewBag.CurrentSubTab      = "Group";
            ViewBag.CurrentSuperSubTab = "Name";
            ViewBag.DisciplineName     = _repoDiscipline.GetSingle(x => x.Id == objGroup.DisciplineId).DisciplineName;
            ViewBag.ProvinceName       = _repoProvince.GetSingle(x => x.Id == objGroup.ProvinceId).NAME_1;
            var objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == objGroup.Id && x.Section.SectionName == "groups");

            if (objEntityFile != null)
            {
                ViewBag.FileId = objEntityFile.FileId.GetValueOrDefault();
            }

            //for comment
            long profileId = 0;

            if (CurrentUser != null)
            {
                var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
                if (objProfile != null)
                {
                    profileId = objProfile.Id;
                }
            }
            ViewData["ProfileId"] = profileId;
            ViewData["Url"]       = Request.RawUrl;
            ViewData["EntityId"]  = id;
            ViewData["SectionId"] = 2;

            var objFavourite = _repoFavourite.GetSingle(x => x.SectionId == 2 && x.EntityId == id);

            if (objFavourite != null)
            {
                objGroup.isFavourite = true;
            }
            else
            {
                objGroup.isFavourite = false;
            }


            //--------------
            return(View(objGroup));
        }