コード例 #1
0
        public async Task <IActionResult> CreateEdit()
        {
            DeTaiNghienCuuViewModel model = new DeTaiNghienCuuViewModel();
            var entity = await _service.GetEntity(x => x.IdNguoiDangKy == long.Parse(User.Identity.Name) && x.Loai == LoaiDeTai.DeXuat);

            if (entity == null)
            {
                return(PartialView("_CreateEditPopup"));
            }
            else
            {
                model = _mapper.Map <DeTaiNghienCuu, DeTaiNghienCuuViewModel>(entity);
                return(PartialView("_CreateEditPopup", model));
            }
        }
コード例 #2
0
ファイル: MoDotController.cs プロジェクト: war-man/KLTN-1
        public async Task <IActionResult> Index(string mess)
        {
            IEnumerable <MoDot> listDotDangKy = await _service.GetAll(x => x.Loai == (int)MoDotLoai.DangKy);

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

            MoDot moDot = await _service.GetEntity(x => x.Status == (int)MoDotStatus.Mo);

            DeTaiNghienCuu detai = await _serviceDeTai.GetEntity(x => x.NgayThucHien != null && x.NgayDangKy > DotDangKyMoiNhat.ThoiGianBd && x.NgayDangKy < DotDangKyMoiNhat.ThoiGianKt);

            if (mess != "")
            {
                ViewBag.mess = mess;
            }
            if (detai != null)
            {
                ViewBag.NgayBdDeTai = detai.NgayThucHien.Value.ToString("yyyy-MM-dd'T'HH:mm:ss");
                ViewBag.NgayKtDeTai = detai.NgayKetThuc.Value.ToString("yyyy-MM-dd'T'HH:mm:ss");
            }

            if (moDot != null)
            {
                if (DateTime.Now > moDot.ThoiGianKt.Value)
                {
                    moDot.Status = (int)MoDotStatus.Dong;
                    await _service.Update(moDot);
                }
            }

            return(View(moDot));
        }