public ActionResult Detail(int id) { //Get all co quan lien qua by tacNghiepId var cqlq = TacNghiepTinhHinhThucHienRepository.GetAllByTacNghiepId(id); var lvtn = LinhVucTacNghiepRepository.GetAll().Select(x => x.ToDataInfo()); var result = TacNghiepRepository.Single(id); var ncq = new List <InitCoQuanCoLienQuan>(); NhomCoQuanRepository.GetAllWithChildren().ToList().ForEach(x => { ncq.Add(new InitCoQuanCoLienQuan { NhomCoQuan = x.ToDataInfo(), CoQuanInfos = x.CoQuanResult.Select(s => s.ToDataInfo()).ToList().Update((r) => { r.ToList().ForEach(f => { f.IsSelected = cqlq.Where(w => w.CoQuanId == f.Id).Any(); }); }).ToList(), }); }); //get files in folder upload var urlFiles = EnsureFolderTacNghiep(id); var detail = new DetailTacNghiepViewModel { Id = id, NgayHetHan = result.NgayHetHan, NgayHoanThanh = result.NgayHoanThanh, NgayTao = result.NgayTao, NoiDung = result.NoiDung, NoiDungYKienTraoDoi = result.NoiDungTraoDoi, LinhVucTacNghiepId = result.LinhVucTacNghiepInfo.Id, CoQuanInfos = cqlq, LinhVucTacNghiepInfo = lvtn, NhomCoQuanCoLienQuanInfo = ncq, JsonFiles = GetPathFiles(urlFiles), IsRoleAdmin = User.IsInRole(RoleConstant.SUPPER_ADMIN) || User.IsInRole(RoleConstant.ADMIN), }; return(View(detail)); }
public JsonResult EditRecord(DetailTacNghiepViewModel model) { return(ExecuteWithErrorHandling(() => { var result = TacNghiepRepository.Single(model.Id); result.NgayTao = model.NgayTao; result.NgayHoanThanh = model.NgayHoanThanh; result.NgayHetHan = model.NgayHetHan; result.NoiDung = model.NoiDung; result.NoiDungTraoDoi = model.NoiDungYKienTraoDoi; result.LastUpdatedBy = UserName; return ExecuteResult(() => { return TacNghiepRepository.Update(result); }); })); }