예제 #1
0
        public ActionResult Invite(InviteStudentModel model)
        {
            UnitOfWork  uow          = new UnitOfWork();
            List <User> searcResults = uow.Users.Get(x => x.UserRole == (int)UserRoles.Student && x.FirstName.Contains(model.SearchKeyword) ||
                                                     x.LastName.Contains(model.SearchKeyword) || x.Email.Contains(model.SearchKeyword)).ToList();

            model.Students = searcResults;
            ClassEditModel classDetail = uow.TeacherRepository.GetClassData(model.ClassID);

            model.ClassTitle = classDetail.Title;
            model.ClassID    = classDetail.ClassId;
            if (!string.IsNullOrEmpty(model.StudentID))
            {
                if (CreateInviteStudentClass(model.StudentID, model.ClassID, model.ClassTitle))
                {
                    ModelState.AddModelError("success", Resources.Resources.MsgStudentInvited);
                }
                else
                {
                    ModelState.AddModelError("success", Resources.Resources.LblMultipleStudentError);
                }
            }

            ModelState.AddModelError("success", Resources.Resources.MsgStudentInvited);
            return(View(model));
        }
예제 #2
0
        public ActionResult Invite(string id)
        {
            UnitOfWork         uow         = new UnitOfWork();
            ClassEditModel     classDetail = uow.TeacherRepository.GetClassData(id);
            InviteStudentModel model       = new InviteStudentModel();

            model.ClassTitle = classDetail.Title;
            model.ClassID    = classDetail.ClassId;
            return(View(model));
        }