public ActionResult Detail(int id) { var hoso = HoSoCongViecRepository.Single(id); var init = InitModel(); var coQuanInfos = CoQuanRepository.GetAll().Select(x => x.ToDataInfo()); var model = new EditCongViecViewModel { Id = id, UsersInfos = init.UsersInfos, LinhVucCongViecInfos = init.LinhVucCongViecInfos, TrangThaiCongViecInfos = init.TrangThaiCongViecInfos, CoQuanInfos = coQuanInfos, LinhVucCongViecId = hoso.LinhVucCongViecId, VanBanLienQuanViewModel = hoso.CongViecVanBanResults.ToList(), QuaTrinhXuLyViewModel = hoso.CongViecQuaTrinhXuLyResult.ToList(), NgayHetHan = hoso.NgayHetHan, NgayKhoiTao = hoso.NgayTao, NoiDungCongViec = hoso.NoiDung, TrangThaiCongViecId = hoso.TrangThaiCongViecId, UserPhuTrachId = hoso.UserPhuTrachId, UserXuLyChinhId = hoso.UserXuLyId, UsersPhoiHopId = hoso.CongViecPhoiHopResult.Select(x => x.UserId).ToArray(), DanhGiaCongViec = hoso.DanhGiaCongViec.HasValue ? (EnumDanhGiaCongViec)hoso.DanhGiaCongViec.Value : EnumDanhGiaCongViec.LEVEL0, JsonFiles = GetPathFiles(EnsureFolderCongViec(id)) }; return(View(model)); }
public JsonResult Detail(int id, EditCongViecViewModel model) { return(ExecuteWithErrorHandling(() => { var congViec = HoSoCongViecRepository.Single(id); //Get all van ban lien quan AddOrUpdateXuLy(id, model); AddOrUpdateVanBan(id, model); if (User.IsInRole(RoleConstant.LANHDAO)) { congViec.NgayHetHan = model.NgayHetHan; congViec.LinhVucCongViecId = model.LinhVucCongViecId; congViec.UserPhuTrachId = model.UserPhuTrachId; congViec.DanhGiaCongViec = model.DanhGiaCongViec == EnumDanhGiaCongViec.LEVEL0 ? null : (byte?)model.DanhGiaCongViec; congViec.UserXuLyId = model.UserXuLyChinhId; congViec.CongViecPhoiHopResult = model.UsersPhoiHopId?.Select(x => new CongViecPhoiHopResult { UserId = x, HoSoCongViecId = id }); } congViec.TrangThaiCongViecId = model.TrangThaiCongViecId; AddOrUpdatePhoiHop(id, congViec.CongViecPhoiHopResult); HoSoCongViecRepository.Update(congViec); return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = "SB01" } }; })); }