Beispiel #1
0
        private List <ViewDaoTaoLyLich> GetDaoTao(ViewLyLich daotao)
        {
            var model  = new List <ViewDaoTaoLyLich>();
            var result = unitOfWork.QuaTrinhDaoTaoRepository.Get(x => x.IdMaLyLich == daotao.Id.ToString());

            if (result.Count() == 0)
            {
                var vm = new ViewDaoTaoLyLich();
                vm.IdLyLich = daotao.Id;
                vm.MaLyLich = daotao.MaLyLich;
                model.Add(vm);
                return(model);
            }
            else
            {
                var vm = (from s in result
                          select new ViewDaoTaoLyLich
                {
                    Id = s.Id,
                    IdLyLich = daotao.Id,
                    MaLyLich = s.IdMaLyLich,
                    MaBacDaoTao = s.MaBacDaoTao,
                    TenBacDaoTao = unitOfWork.HocViRepository.Get(x => x.MaHocVi == s.MaBacDaoTao).FirstOrDefault().TenHocVi,
                    NoiDaoTao = s.NoiDaoTao,
                    ChuyenMon = s.ChuyenMon,
                    NamTotNghiep = s.NamTotNghiep,
                    GhiChu = s.GhiChu
                }).OrderByDescending(x => x.NamTotNghiep).ToList();

                return(vm);
            }
        }
Beispiel #2
0
        public ActionResult EditDaoTao(ViewDaoTaoLyLich model)
        {
            var vm = unitOfWork.QuaTrinhDaoTaoRepository.Get(x => x.Id == model.Id && x.IdMaLyLich == model.IdLyLich.ToString()).FirstOrDefault();

            vm.MaBacDaoTao  = model.MaBacDaoTao;
            vm.NamTotNghiep = model.NamTotNghiep;
            vm.NoiDaoTao    = model.NoiDaoTao;
            vm.ChuyenMon    = model.ChuyenMon;
            unitOfWork.QuaTrinhDaoTaoRepository.Update(vm);
            unitOfWork.Save();
            return(RedirectToAction("ThongTinLyLich", new { Id = model.IdLyLich }));
        }
Beispiel #3
0
        public ActionResult EditDaoTao(int Id, int IdLyLich, string MaLyLich)
        {
            var vm    = new ViewDaoTaoLyLich();
            var model = unitOfWork.QuaTrinhDaoTaoRepository.Get(x => x.Id == Id).FirstOrDefault();

            vm.Id           = Id;
            vm.IdLyLich     = IdLyLich;
            vm.MaLyLich     = MaLyLich;
            vm.MaBacDaoTao  = model.MaBacDaoTao;
            vm.NamTotNghiep = model.NamTotNghiep;
            vm.NoiDaoTao    = model.NoiDaoTao;
            vm.ChuyenMon    = model.ChuyenMon;
            vm.GhiChu       = string.Empty;
            ViewBag.HocVi   = unitOfWork.HocViRepository.Get().ToList();
            return(View(vm));
        }