Beispiel #1
0
        public async Task <IViewComponentResult> InvokeAsync(long?idGiangVien)
        {
            if (idGiangVien.HasValue)
            {
                ViewBag.Selected = idGiangVien.Value;
            }
            IEnumerable <GiangVien> model = await _service.GetAll(x => x.Status == (int)BaseStatus.Active);

            return(await Task.FromResult <IViewComponentResult>(View(model)));
        }
Beispiel #2
0
        public async Task <IActionResult> Index(string mess)
        {
            IEnumerable <MoDot> listDotDangKy = await _serviceMoDot.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

            if (!listDotDangKy.Any())
            {
                return(View());
            }
            MoDot DotDangKyMoiNhat = listDotDangKy.ToList().LastOrDefault();

            IEnumerable <DeTaiNghienCuu> listDeTaiHienTai = await _service.GetAll(x => x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.DaDangKy ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.HoanThanh ||
                                                                                  x.TinhTrangDeTai == (int)StatusDeTai.Huy &&
                                                                                  (x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt) ||
                                                                                  (x.NgayDangKy == null && x.TinhTrangDeTai == (int)StatusDeTai.DaDuyet));

            IEnumerable <DeTaiNghienCuu> listDeTaiDeXuatHienTai = await _service.GetAll(x => x.Loai == LoaiDeTai.DeXuat &&
                                                                                        x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd &&
                                                                                        x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt);

            IEnumerable <GiangVien> listGiangVien = await _serviceGiangVien.GetAll();

            DeTaiNghienCuuAdminViewModel viewModel = new DeTaiNghienCuuAdminViewModel()
            {
                DotDangKyHienTai       = DotDangKyMoiNhat,
                listDeTaiHienTai       = listDeTaiHienTai,
                listDeTaiDeXuatHienTai = listDeTaiDeXuatHienTai,
                listGiangVien          = listGiangVien.Select(a => new SelectListItem()
                {
                    Value = a.Id.ToString(),
                    Text  = a.Ho + " " + a.Ten
                }).ToList()
            };

            if (mess != "")
            {
                ViewBag.mess = mess;
            }

            return(View(viewModel));
        }