Exemple #1
0
        private void createRolesandUsers()
        {
            UserUtility.CreateRole("Admin");
            UserUtility.CreateRole("52th");
            UserUtility.CreateRole("53th");
            UserUtility.CreateRole("54th");
            UserUtility.CreateRole("55th");
            UserUtility.CreateRole("56th");
            UserUtility.CreateRole("57th");
            UserUtility.CreateRole("58th");
            UserUtility.CreateRole("59th");
            UserUtility.CreateRole("60th");

            HogwartsSettingUtility.CreateHogwartsSettingInitialize(HogwartsSettingUtility.NowDisplayRole, "Sample");

            HogwartsSettingUtility.CreateHogwartsSettingInitialize(HogwartsSettingUtility.NowLecture, null);

            UserUtility.CreateUser("manager", "manager", "*****@*****.**", "P@ssw0rd", "Admin");
            UserUtility.CreateRole("Sample");
            UserUtility.CreateUser("sample1", "sample1", "*****@*****.**", "P@ssw0rd", "Sample");
            UserUtility.CreateUser("sample2", "sample2", "*****@*****.**", "P@ssw0rd", "Sample");
            UserUtility.CreateUser("sample3", "sample3", "*****@*****.**", "P@ssw0rd", "Sample");
            UserUtility.CreateUser("sample4", "sample4", "*****@*****.**", "P@ssw0rd", "Sample");
            UserUtility.CreateUser("sample5", "sample5", "*****@*****.**", "P@ssw0rd", "Sample");
        }
Exemple #2
0
        private static SubLecture AddSubLecture(SettingAjaxParam ajaxParam)
        {
            var showOrder = 1;

            if (new ApplicationDbContext().SubLectures.Any())
            {
                showOrder = new ApplicationDbContext().SubLectures.Max(x => x.ShowOrder) + 1;
            }

            var subLecture = new SubLecture
            {
                LectureId      = ajaxParam.ParentId,
                SubLectureName = ajaxParam.Text,
                ShowOrder      = showOrder,
                StartDateTime  = DateTime.Now,
                EndDateTime    = DateTime.Now,
                Role           = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole)
            };

            using (var db = new ApplicationDbContext())
            {
                try
                {
                    db.SubLectures.Add(subLecture);
                    db.SaveChanges();
                }
                catch
                {
                    return(null);
                }
            }
            return(subLecture);
        }
Exemple #3
0
        // GET: Group
        public ActionResult Index()
        {
            var role        = HogwartsSettingUtility.GetNowDisplayRole();
            var user        = db.Users.Where(x => x.UserName == User.Identity.Name).First();
            var belongGroup = db.GroupMembers.Where(x => x.Role == role &&
                                                    x.UserId == user.Id)
                              .FirstOrDefault();
            Group group;

            if (belongGroup == null)
            {
                group = new Group
                {
                    GroupName = "グループに所属していません。グループに参加してください。"
                };
            }
            else
            {
                group = db.Groups.Where(x => x.Id == belongGroup.GroupId).FirstOrDefault();
            }
            ViewBag.MyGroup    = group;
            ViewBag.NowLecture = HogwartsSettingUtility.GetNowLecture();

            return(View());
        }
Exemple #4
0
        public static JsonResult UpdateAnswerState(AnswerStateAjaxParam ajaxParam, ApplicationUser user)
        {
            var             ajaxResult = new AjaxResult();
            var             role       = HogwartsSettingUtility.GetNowDisplayRole();
            UserAnswerState answerState;

            using (var db = new ApplicationDbContext())
            {
                try
                {
                    answerState = db.UserAnswerStates.Where(x => x.QuestionId == ajaxParam.Id &&
                                                            x.UserId == user.Id).FirstOrDefault();
                    var isNew = false;
                    if (answerState == null)
                    {
                        answerState = new UserAnswerState
                        {
                            QuestionId     = ajaxParam.Id,
                            Role           = role,
                            UserId         = user.Id,
                            UpdateDateTime = DateTime.Now,
                        };
                        isNew = true;
                    }

                    if (ajaxParam.UpdateKBN == 0)
                    {
                        answerState.Progress = ajaxParam.Value;
                    }
                    else if (ajaxParam.UpdateKBN == 1)
                    {
                        answerState.UnderStandingLevel = ajaxParam.Value;
                    }
                    else
                    {
                        ajaxResult.Message    = "追加失敗。とりあえずF5更新やな";
                        ajaxResult.ResultData = null;
                    }

                    if (isNew)
                    {
                        db.UserAnswerStates.Add(answerState);
                    }
                    else
                    {
                        db.Entry(answerState).State = EntityState.Modified;
                    }
                    db.SaveChanges();
                    ajaxResult.ResultData = ajaxParam;
                    ajaxResult.Result     = true;
                }
                catch
                {
                    ajaxResult.Message = "追加失敗。とりあえずF5更新やな";
                    return(null);
                }
            }

            return(ajaxResult.GetJsonRsult());
        }
Exemple #5
0
        public JsonResult RegistAnswer(Ask answer)
        {
            try
            {
                var ask = db.Asks.Where(x => x.Id == answer.ParentAskId).FirstOrDefault();
                if (ask != null)
                {
                    var user = db.Users.Where(x => x.UserName == User.Identity.Name).First();
                    var role = HogwartsSettingUtility.GetNowDisplayRole();
                    answer.Role           = role;
                    answer.IsClosed       = false;
                    answer.CreateDateTime = DateTime.Now;
                    answer.UpdateDateTime = DateTime.Now;
                    answer.CreateUserId   = user.Id;
                    db.Asks.Add(answer);
                    ask.UpdateDateTime = DateTime.Now;
                    db.SaveChanges();
                }
                else
                {
                    return(Json(new { result = "Error", message = "該当する質問は存在しません" }));
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Json(new { result = "Redirect", url = Url.Action("Index", "Asks") }));
        }
        public JsonResult RegistUser(string text)
        {
            var ajaxResult = new AjaxResult();

            var rows           = text.Replace("\r\n", "\n").Split('\n');
            var nowDisplayRole = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole);
            var email          = nowDisplayRole + @"@obic.co.jp";
            var registCounter  = 0;

            foreach (var row in rows)
            {
                if (row == string.Empty)
                {
                    continue;
                }

                try
                {
                    var columns = row.Split('\t');
                    UserUtility.CreateUser(columns[0], columns[1], email, "P@ssw0rd", nowDisplayRole);
                    registCounter++;
                }
                catch (Exception e)
                {
                    ajaxResult.Message = e.Message;
                }
            }
            ajaxResult.ResultData = registCounter.ToString() + "人登録しました";
            ajaxResult.Result     = true;
            return(ajaxResult.GetJsonRsult());
        }
        public ActionResult LectureSettingView()
        {
            var nowDisplayRole = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole);

            ViewBag.Lectures = LectureUtility.GetLecturesInNowRole(nowDisplayRole);
            return(PartialView("_LectureSettingView"));
        }
 public JsonResult ChangeNowLecture(Lecture lecture)
 {
     using (var db = new ApplicationDbContext())
     {
         HogwartsSettingUtility.UpdateHogwartsSetting(HogwartsSettingUtility.NowLecture, lecture.Id.ToString());
     }
     return(Json(new { result = "Redirect", url = Url.Action("Index", "HogwartsSettings") }));
 }
        public ActionResult GroupRanking()
        {
            var nowLecture = HogwartsSettingUtility.GetNowLecture();
            var userInRole = UserUtility.GetUserListInNowDisplayGroup().ToDictionary(x => x.Id);

            ViewBag.GroupPracticeRecords = RankingUtility.GetGroupPracticeRecordViewModels(nowLecture.Id, userInRole);
            ViewBag.GroupPointRecords    = RankingUtility.GetGroupPointRecordViewModels(nowLecture.Id, userInRole);
            return(PartialView("_GroupRankingView"));
        }
 public JsonResult ChangeNowDisplayRole(IdentityRole identityRole)
 {
     using (var db = new ApplicationDbContext())
     {
         var role = db.Roles.Find(identityRole.Id);
         HogwartsSettingUtility.UpdateHogwartsSetting(HogwartsSettingUtility.NowDisplayRole, role.Name);
     }
     return(Json(new { result = "Redirect", url = Url.Action("Index", "HogwartsSettings") }));
 }
Exemple #11
0
        // GET: Knowledge/Create
        public ActionResult Create()
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();

            ViewBag.KnowledgeCategories = db.KnowledgeCategories.Where(x => x.Role == role)
                                          .OrderByDescending(x => x.CategoryName)
                                          .ToList();
            return(View());
        }
        public ActionResult Index()
        {
            var nowLecture = HogwartsSettingUtility.GetNowLecture();
            var userInRole = UserUtility.GetUserListInNowDisplayGroup().ToDictionary(x => x.Id);

            ViewBag.UserPointRecords = RankingUtility.GetUserPointRecordViewModels(nowLecture.Id, userInRole).OrderBy(x => x.UserLoginId);

            ViewBag.GroupPointRecords = RankingUtility.GetGroupPointRecordViewModels(nowLecture.Id, userInRole);
            return(View());
        }
        public ActionResult UserRanking()
        {
            var nowLecture = HogwartsSettingUtility.GetNowLecture();
            var user       = db.Users.Where(x => x.UserName == User.Identity.Name).First();
            var userInRole = UserUtility.GetUserListInNowDisplayGroup().ToDictionary(x => x.Id);

            ViewBag.UserPracticeRecords = RankingUtility.GetUserPracticeRecordViewModels(nowLecture.Id, userInRole);
            ViewBag.UserPointRecords    = RankingUtility.GetUserPointRecordViewModels(nowLecture.Id, userInRole);

            return(PartialView("_UserRankingView"));
        }
        // GET: HogwartsSettings
        public ActionResult Index()
        {
            var nowDisplayRole = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole);

            ViewBag.Roles = UserUtility.GetAllRoleExceptAdmin();
            ViewBag.LecturesForSelectBox = LectureUtility.GetLecturesInNowRole(nowDisplayRole);
            ViewBag.NowDisplayRole       = nowDisplayRole;
            ViewBag.NowLecture           = HogwartsSettingUtility.GetNowLecture();

            return(View(db.HogwartsSettings.ToList()));
        }
        public ActionResult UserProgress()
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();
            var user = db.Users.Where(x => x.UserName == User.Identity.Name).First();

            ViewBag.Lectures         = db.Lectures.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();
            ViewBag.SubLectures      = db.SubLectures.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();
            ViewBag.Questions        = db.Questions.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();
            ViewBag.UserAnswerStates = db.UserAnswerStates.Where(x => x.UserId == user.Id).ToList();
            ViewBag.NowLecture       = HogwartsSettingUtility.GetNowLecture();
            return(PartialView("_UserProgress"));
        }
Exemple #16
0
        private static JsonResult UpdateGroupRecord(RecordAjaxParam ajaxParam)
        {
            var         ajaxResult = new AjaxResult();
            var         role       = HogwartsSettingUtility.GetNowDisplayRole();
            var         nowLecture = HogwartsSettingUtility.GetNowLecture();
            GroupRecord groupRecord;

            using (var db = new ApplicationDbContext())
            {
                try
                {
                    groupRecord = db.GroupRecords.Where(x => x.GroupId == ajaxParam.GroupId &&
                                                        x.LectureId == nowLecture.Id)
                                  .FirstOrDefault();
                    var isNew = false;
                    if (groupRecord == null)
                    {
                        groupRecord = new GroupRecord
                        {
                            LectureId = nowLecture.Id,
                            Role      = role,
                            GroupId   = ajaxParam.GroupId,
                            Point     = ajaxParam.Point,
                        };
                        isNew = true;
                    }

                    if (isNew)
                    {
                        db.GroupRecords.Add(groupRecord);
                    }
                    else
                    {
                        groupRecord.Point           = groupRecord.Point + ajaxParam.Point;
                        db.Entry(groupRecord).State = EntityState.Modified;
                    }
                    db.SaveChanges();
                    ajaxParam.Point       = groupRecord.Point;
                    ajaxResult.ResultData = ajaxParam;
                    ajaxResult.Result     = true;
                }
                catch
                {
                    ajaxResult.Message = "追加失敗。とりあえずF5更新やな";
                    return(null);
                }
            }

            return(ajaxResult.GetJsonRsult());
        }
Exemple #17
0
        public JsonResult RegistGroup(Group group, IEnumerable <string> UserIds, bool IsEdit)
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();

            if (IsEdit)
            {
                var g = db.Groups.Find(group.Id);
                g.GroupName = group.GroupName;
                var groupMember = db.GroupMembers.Where(x => x.GroupId == group.Id);
                db.GroupMembers.RemoveRange(groupMember);
            }
            else
            {
                group.Point     = 0;
                group.Role      = role;
                group.LectureId = HogwartsSettingUtility.GetNowLecture().Id;
                db.Groups.Add(group);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            foreach (var userId in UserIds)
            {
                var member = new GroupMember
                {
                    GroupId = group.Id,
                    Role    = role,
                    UserId  = userId
                };
                db.GroupMembers.Add(member);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            return(Json(new { result = "Redirect", url = Url.Action("Index", "Group") }));
        }
Exemple #18
0
        // GET: Knowledge
        public ActionResult Index(int?knowledgeCategoryId)
        {
            //return View(db.Knowledges.ToList());
            var role     = HogwartsSettingUtility.GetNowDisplayRole();
            var category = db.KnowledgeCategories.Where(x => x.Id == knowledgeCategoryId).FirstOrDefault();

            ViewBag.KnowledgeCategories = db.KnowledgeCategories.Where(x => x.Role == role)
                                          .OrderByDescending(x => x.CategoryName)
                                          .ToList();
            if (category == null)
            {
                category = new KnowledgeCategory
                {
                    Id           = 0,
                    CategoryName = "全件"
                };
            }
            ViewBag.DisplayCategory = category;
            var knowledges = db.Knowledges.Where(x =>
                                                 knowledgeCategoryId != null ? x.CategoryId == knowledgeCategoryId : true &&
                                                 x.Role == role)
                             .OrderByDescending(x => x.UpdateDateTime)
                             .ToList();
            var users = UserUtility.GetUserListInNowDisplayGroup().ToDictionary(u => u.Id);
            var knowledgeViewModels = knowledges.Select(x =>
            {
                ApplicationUser user;
                var existUser = false;
                if (users.TryGetValue(x.CreateUserId, out user))
                {
                    existUser = true;
                }
                return(new KnowledgeViewModel
                {
                    Id = x.Id,
                    Title = x.Title,
                    CategoryId = x.CategoryId,
                    Content = x.Content.HtmlToPlainText(50),
                    CreateDateTime = x.CreateDateTime,
                    UpdateDateTime = x.UpdateDateTime,
                    Role = x.Role,
                    CreateUserId = existUser ? user.UserID : "manager",
                    UserName = existUser ? user.UserName : "******",
                });
            });

            ViewBag.KnowledgeViewModels = knowledgeViewModels;
            return(View());
        }
        public ActionResult ProgressManage()
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();

            var userInRole  = UserUtility.GetUserListInNowDisplayGroup();
            var lectures    = db.Lectures.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();
            var subLectures = db.SubLectures.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();
            var questions   = db.Questions.Where(x => x.Role == role).OrderBy(x => x.ShowOrder).ToList();

            var targetTraineeOfLectures = db.TargetTraineeOfLectures
                                          .Join(db.Lectures,
                                                t => t.LectureId,
                                                l => l.Id,
                                                (t, l) => new { t, l })
                                          .Where(x => x.l.Role == role)
                                          .ToList();
            var progressManageViewModels = db.UserAnswerStates
                                           .Where(x => x.Role == role)
                                           .GroupBy(x => x.QuestionId)
                                           .ToList();

            var dicUserCount = new Dictionary <int, int>();

            foreach (var question in questions)
            {
                var sublecture = subLectures.Where(x => x.Id == question.SubLectureId).FirstOrDefault();
                var lecture    = lectures.Where(x => x.Id == sublecture.LectureId).FirstOrDefault();
                var userCount  = targetTraineeOfLectures.Where(x => x.t.LectureId == lecture.Id).Count();
                dicUserCount.Add(question.Id, userCount != 0 ? userCount : userInRole.Count());
            }

            ViewBag.ProgressManageViewModels = progressManageViewModels
                                               .Where(x => dicUserCount.ContainsKey(x.Key))
                                               .Select(x =>
                                                       new ProgressManageViewModel
            {
                QuestionId         = x.Key,
                Progress           = x.Sum(y => y.Progress) / dicUserCount[x.Key],
                UnderStandingLevel = x.Sum(y => y.UnderStandingLevel) / dicUserCount[x.Key],
                NotStartYet        = dicUserCount[x.Key] - x.Count(y => y.Progress != 0),
                InProcess          = x.Count(y => y.Progress != 0 && y.Progress != 100),
                Completion         = x.Count(y => y.Progress == 100)
            }).ToList();
            ViewBag.Lectures     = lectures;
            ViewBag.SubLectures  = subLectures;
            ViewBag.Questions    = questions;
            ViewBag.DicUserCount = dicUserCount;
            return(PartialView("_ProgressManage"));
        }
Exemple #20
0
        public JsonResult CreateKnowledgeCategory(string knowledgeCategoryName)
        {
            if (db.KnowledgeCategories.Where(x => x.CategoryName == knowledgeCategoryName).Any())
            {
                return(Json(new { result = "False", Message = "すでに存在しています。" }));
            }
            var role = HogwartsSettingUtility.GetNowDisplayRole();
            var knowledgeCategory = new KnowledgeCategory();

            knowledgeCategory.CategoryName = knowledgeCategoryName;
            knowledgeCategory.Role         = role;
            db.KnowledgeCategories.Add(knowledgeCategory);
            db.SaveChanges();
            return(Json(new { result = "Redirect", url = Url.Action("Index", "Knowledge") }));
        }
Exemple #21
0
        // GET: Asks
        public ActionResult Index()
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();
            var asks = db.Asks.Where(x => x.Role == role &&
                                     x.ParentAskId == -1)
                       .OrderByDescending(x => x.UpdateDateTime)
                       .ToList();
            var answer = db.Asks.Where(x => x.Role == role &&
                                       x.ParentAskId != -1)
                         .OrderBy(x => x.UpdateDateTime)
                         .ToList();
            var users         = UserUtility.GetUserListInNowDisplayGroup().ToDictionary(u => u.Id);
            var askViewModels = asks.Select(x =>
            {
                ApplicationUser user;
                var existUser = false;
                var isMyAsk   = false;
                if (users.TryGetValue(x.CreateUserId, out user))
                {
                    existUser = true;
                }

                if ((existUser && user.UserID == User.Identity.Name) || User.IsInRole("Admin"))
                {
                    isMyAsk = true;
                }
                return(new AskViewModel
                {
                    Id = x.Id,
                    ParentAskId = x.ParentAskId,
                    Content = x.Content.HtmlToPlainText(50),
                    CreateDateTime = x.CreateDateTime,
                    UpdateDateTime = x.UpdateDateTime,
                    IsClosed = x.IsClosed,
                    Role = x.Role,
                    AnswerCount = answer.Count(y => y.ParentAskId == x.Id),
                    CreateUserId = existUser ? user.UserID : "manager",
                    CreateUserName = existUser ? user.UserName : "******",
                    IsMyAsk = isMyAsk
                });
            });

            return(View(askViewModels));
        }
Exemple #22
0
        public ActionResult Create([Bind(Include = "Id,Content")] Ask ask)
        {
            if (ModelState.IsValid)
            {
                var role = HogwartsSettingUtility.GetNowDisplayRole();
                var user = db.Users.Where(x => x.UserName == User.Identity.Name).First();
                ask.CreateDateTime = DateTime.Now;
                ask.UpdateDateTime = DateTime.Now;
                ask.ParentAskId    = -1;
                ask.Role           = role;
                ask.IsClosed       = false;
                ask.CreateUserId   = user.Id;
                db.Asks.Add(ask);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ask));
        }
Exemple #23
0
        // GET: Knowledge/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Knowledge knowledge = db.Knowledges.Find(id);

            if (knowledge == null)
            {
                return(HttpNotFound());
            }
            var role = HogwartsSettingUtility.GetNowDisplayRole();

            ViewBag.KnowledgeCategories = db.KnowledgeCategories.Where(x => x.Role == role)
                                          .OrderByDescending(x => x.CategoryName)
                                          .ToList();
            return(View(knowledge));
        }
Exemple #24
0
        private static Question AddQuestion(SettingAjaxParam ajaxParam)
        {
            var questionNO = 1;

            if (new ApplicationDbContext().Questions.Any())
            {
                questionNO = new ApplicationDbContext().Questions.Max(x => x.QuestionNO) + 1;
            }

            var showOrder = 0;

            if (new ApplicationDbContext().Questions.Any())
            {
                showOrder = new ApplicationDbContext().Questions.Max(x => x.ShowOrder) + 1;
            }

            var question = new Question
            {
                SubLectureId = ajaxParam.ParentId,
                QuestionNO   = questionNO,
                QuestionName = ajaxParam.Text,
                ShowOrder    = showOrder,
                Difficulty   = 1,
                EstimateTime = 5,
                Role         = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole)
            };

            using (var db = new ApplicationDbContext())
            {
                try
                {
                    db.Questions.Add(question);
                    db.SaveChanges();
                }
                catch
                {
                    return(null);
                }
            }
            return(question);
        }
Exemple #25
0
        public ActionResult Create([Bind(Include = "Title,CategoryId,Content")] Knowledge knowledge)
        {
            var role = HogwartsSettingUtility.GetNowDisplayRole();

            if (ModelState.IsValid && knowledge.CategoryId > 0)
            {
                var user = db.Users.Where(x => x.UserName == User.Identity.Name).First();
                knowledge.IsPublic       = true;
                knowledge.Role           = role;
                knowledge.CreateDateTime = DateTime.Now;
                knowledge.UpdateDateTime = DateTime.Now;
                knowledge.CreateUserId   = user.Id;
                db.Knowledges.Add(knowledge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.KnowledgeCategories = db.KnowledgeCategories.Where(x => x.Role == role)
                                          .OrderByDescending(x => x.CategoryName)
                                          .ToList();
            return(View(knowledge));
        }
Exemple #26
0
        public ActionResult GroupMemberProgressView(int?groupId)
        {
            var nowLecture = HogwartsSettingUtility.GetNowLecture();
            var role       = HogwartsSettingUtility.GetNowDisplayRole();

            if (groupId == null)
            {
                var user        = db.Users.Where(x => x.UserName == User.Identity.Name).First();
                var belongGroup = db.GroupMembers.Where(x => x.Role == role &&
                                                        x.UserId == user.Id)
                                  .FirstOrDefault();
                if (belongGroup == null)
                {
                    ViewBag.HasError     = true;
                    ViewBag.ErrorMessage = "所属がグループないか、グループを選択していません";
                    return(PartialView("_GroupMemberProgressView"));
                }

                groupId = belongGroup.GroupId;
            }
            var subLectures   = db.SubLectures.Where(x => x.LectureId == nowLecture.Id).ToList();
            var subLectureIds = subLectures.Select(y => y.Id).ToList();
            var members       = db.GroupMembers.Where(x => x.GroupId == groupId).ToList();
            var membersIds    = members.Select(y => y.UserId).ToList();
            var questions     = db.Questions.Where(x => subLectureIds.Contains(x.SubLectureId)).ToList();
            var questionIds   = questions.Select(y => y.Id).ToList();

            ViewBag.UserAnserStates = db.UserAnswerStates.Where(x =>
                                                                membersIds.Contains(x.UserId) &&
                                                                questionIds.Contains(x.QuestionId)).ToList();
            ViewBag.Questions   = questions;
            ViewBag.SubLectures = subLectures;
            ViewBag.Members     = db.Users.Where(x => membersIds.Contains(x.Id)).ToList();
            ViewBag.HasError    = false;
            return(PartialView("_GroupMemberProgressView"));
        }