Beispiel #1
0
        public async Task <IActionResult> Students(StudentsSearchRequest searchRequest)
        {
            var model = new StudentSearchModel();

            if (searchRequest != null)
            {
                var searchParameters = RequestParameters.CreateFromModel(searchRequest); // Generates url parameters from searchRequest object
                searchParameters.Add("Test", true);                                      // Also, you can specify additional parameters

                var response = await GetRequest($@"{_settings.Value.ApiUrl}/api/Student/search", searchParameters);

                var responseObject = JsonConvert.DeserializeObject <StudentsSearchResponse>(
                    await response.Content.ReadAsStringAsync());

                model.SearchResult = responseObject.Students;
            }

            model.SearchParameters = searchRequest;

            var gradeResponse = await GetRequest($@"{_settings.Value.ApiUrl}/api/Grade/get-all");

            var greadesList = JsonConvert.DeserializeObject <List <Grade> >(
                await gradeResponse.Content.ReadAsStringAsync());

            model.AvailableGrades = greadesList.Select(x =>
                                                       new SelectListItem(x.GradeName, x.Id.ToString(),
                                                                          searchRequest.SelectedGradeIds == null ? false : searchRequest.SelectedGradeIds.Contains(x.Id))).ToList();

            return(View(model));
        }
Beispiel #2
0
    public IQueryable <Student> GetProducts(StudentSearchModel searchModel)
    {
        var result = Context.Student.AsQueryable();

        if (searchModel != null)
        {
            if (searchModel.ID.HasValue)
            {
                result = result.Where(x => x.ID == searchModel.ID);
            }
            if (!string.IsNullOrEmpty(searchModel.Name))
            {
                result = result.Where(x => x.Name.Contains(searchModel.Name));
            }
            if (!string.IsNullOrEmpty(searchModel.Course))
            {
                result = result.Where(x => x.Course.Contains(searchModel.Course));
            }
            if (searchModel.Paid)
            {
                result = result.Where(x => x.Paid == searchModel.Paid);
            }
        }
        return(result);
    }
Beispiel #3
0
        public IActionResult Index(StudentSearchModel searchData)
        {
            StudentJoinSearchModel          studentResult     = new StudentJoinSearchModel();
            List <DataAndTranscationsModel> studentAllDetails = studentResult.SearchStudentData(searchData);

            return(PartialView("_StudentPartialView", studentAllDetails));
        }
        public ViewResult Index(int Page = 1, string Name = null)
        {
            var model = new StudentSearchModel()
            {
                Name     = Name,
                Students = studentRepository.ByNameLike(Name).AsPagination(Page)
            };

            return(View(model));
        }
        public ActionResult <StudentSearchResModel> GetListByParas(StudentSearchModel model)
        {
            var lists = _studentService.GetListByParas(model);
            StudentSearchResModel resModel = new StudentSearchResModel();

            resModel.IsSuccess                  = true;
            resModel.viewModels                 = lists;
            resModel.TotalNum                   = lists.Count;
            resModel.baseViewModel.Message      = "查询成功";
            resModel.baseViewModel.ResponseCode = 200;
            return(resModel);
        }
Beispiel #6
0
        //获取该年级班级的 学生总数
        public BaseViewModel GetStudentTotalByGC(string GradeCode, string ClassCode)
        {
            BaseViewModel      baseView = new BaseViewModel();
            StudentSearchModel student  = new StudentSearchModel();

            student.GradeCode = GradeCode;
            student.ClassCode = ClassCode;
            var lists = _studentInfoRepository.GetByModel(student);

            baseView.Message      = lists.Count.ToString();
            baseView.ResponseCode = 0;
            return(baseView);
        }
Beispiel #7
0
        //根据条件查询
        public List <Student_Info> GetByModel(StudentSearchModel model)
        {
            //查询条件
            var predicate = WhereExtension.True <Student_Info>();//初始化where表达式

            //姓名
            if (!String.IsNullOrEmpty(model.Name))
            {
                predicate = predicate.And(p => p.Name.Contains(model.Name));
            }
            //身份证
            if (!String.IsNullOrEmpty(model.IdNumber))
            {
                predicate = predicate.And(p => Dtol.Helper.MD5.Decrypt(p.IdNumber).Contains(model.IdNumber));
            }
            //学校
            if (!String.IsNullOrEmpty(model.SchoolCode))
            {
                predicate = predicate.And(p => p.SchoolCode.Equals(model.SchoolCode));
            }
            //年级
            if (!String.IsNullOrEmpty(model.GradeCode))
            {
                predicate = predicate.And(p => p.GradeCode.Equals(model.GradeCode));
            }
            //班级
            if (!String.IsNullOrEmpty(model.ClassCode))
            {
                predicate = predicate.And(p => p.ClassCode.Equals(model.ClassCode));
            }
            //住址
            if (!String.IsNullOrEmpty(model.PermanentAddress))
            {
                predicate = predicate.And(p => p.PermanentAddress.Contains(model.PermanentAddress));
            }
            var result = DbSet.Where(predicate).ToList();


            return(result);
        }
Beispiel #8
0
        //根据条件查询
        public List <StudentMiddle> GetListByParas(StudentSearchModel model)
        {
            List <Student_Info>  lists  = new List <Student_Info>();
            List <StudentMiddle> nlists = new List <StudentMiddle>();

            //if (!string.IsNullOrEmpty(model.IdNumber))
            //{
            //    model.IdNumber = Dtol.Helper.MD5.Md5Hash(model.IdNumber);
            //}

            lists = _studentInfoRepository.GetByModel(model);

            foreach (var item in lists)
            {
                var info = _IMapper.Map <Student_Info, StudentMiddle>(item);

                info.IdNumber = Dtol.Helper.MD5.Decrypt(info.IdNumber);
                nlists.Add(info);
            }

            return(nlists);
        }
Beispiel #9
0
        public IActionResult Get([FromQuery] StudentSearchModel pretraga)
        {
            var query = db.Student.AsQueryable();

            if (pretraga.labVezbaId != null)
            {
                query = query.Where(s => s.LabVezbaStudent.Any(x => x.LabVezbaId == pretraga.labVezbaId));
            }

            query = query.OrderBy(x => x.Indeks);

            var list = query.Select(studentDB => new Student
            {
                Id           = studentDB.Id,
                Ime          = studentDB.Ime,
                Indeks       = studentDB.Indeks,
                Prezime      = studentDB.Prezime,
                Username     = studentDB.Username,
                Notifikacije = studentDB.Notifikacije
            }).ToList();

            return(Ok(list));
        }
Beispiel #10
0
        // GET: Student
        public ActionResult Index()
        {
            try
            {
                using (var context = new BaseDbContext())
                {
                    var lst = (from u in context.Users
                               join ut in context.UserTypes on u.UserTypeId equals ut.Id
                               select ut).ToList();
                    var temp = context.Users.ToList();
                    //var temp2 = context.UserTypes.Where(x => x.Users.Select(y => y.Id).ToList().Contains("b426d975-311a-4a44-ad8f-86a68c903f86")).ToList();
                    var xy = 1;
                    xy += 10;
                }
            }
            catch (Exception)
            {
                throw;
            }
            InitData();
            var data = new StudentSearchModel();

            return(View(data));
        }