Exemplo n.º 1
0
        private void AddOrUpdateVanBan(int id, EditCongViecViewModel model)
        {
            var vanbanUpdate = model.VanBanLienQuanViewModel?.Where(x => x.Id > 0);

            if (vanbanUpdate != null && vanbanUpdate.Any())
            {
                CongViecVanBanRepository.UpdateRange(vanbanUpdate.Select(x => new CongViecVanBanResult
                {
                    Id             = x.Id,
                    HoSoCongViecId = id,
                    SoVanBan       = x.SoVanBan,
                    NgayBanHanh    = x.NgayBanHanh,
                    NoiDung        = x.NoiDung,
                    CoQuanId       = x.CoQuanId,
                    LastUpdatedBy  = UserName,
                    IsDeleted      = false
                }));
            }

            var vanBanAdd = model.VanBanLienQuanViewModel?.Where(x => x.Id == 0);

            if (vanBanAdd != null && vanBanAdd.Any())
            {
                CongViecVanBanRepository.AddRange(vanbanUpdate.Select(x => new CongViecVanBanResult
                {
                    HoSoCongViecId = id,
                    SoVanBan       = x.SoVanBan,
                    NgayBanHanh    = x.NgayBanHanh,
                    NoiDung        = x.NoiDung,
                    CoQuanId       = x.CoQuanId,
                    CreatedBy      = UserName,
                    IsDeleted      = false
                }));
            }
        }
Exemplo n.º 2
0
 public JsonResult DeleteVanBanLienQuan(int vanBanLienQuanId)
 {
     return
         (ExecuteWithErrorHandling(
              () => { return ExecuteResult(() => CongViecVanBanRepository.DeleteBy(vanBanLienQuanId)); }));
 }