コード例 #1
0
      public async Task <ActionResult> Create(BackgroundJobVM vm)
      {
          if (!ModelState.IsValid)
          {
              return(PartialView(vm));
          }
          else
          {
              var backgroupJobGrain = _client.GetGrain <IBackgroundJobGrain>(Guid.NewGuid(), vm.Entity.DeviceId);

              if (vm.Entity.JobType == BackgroundJobType.Timer)
              {
                  await backgroupJobGrain.CreateTimer(vm.Entity.Command,
                                                      new JobPeriod(vm.Entity.StartTime, vm.Entity.Period, vm.Entity.EndTime.Value));
              }
              else
              {
                  await backgroupJobGrain.CreateReminder(vm.Entity.Command,
                                                         new JobPeriod(vm.Entity.StartTime, vm.Entity.Period, vm.Entity.EndTime.Value));
              }
              //vm.DoAdd();

              if (!ModelState.IsValid)
              {
                  vm.DoReInit();
                  return(PartialView(vm));
              }
              else
              {
                  return(FFResult().CloseDialog().RefreshGrid());
              }
          }
      }
コード例 #2
0
 public ActionResult Edit(BackgroundJobVM vm)
 {
     if (!ModelState.IsValid)
     {
         return(PartialView(vm));
     }
     else
     {
         vm.DoEdit();
         if (!ModelState.IsValid)
         {
             vm.DoReInit();
             return(PartialView(vm));
         }
         else
         {
             return(FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID));
         }
     }
 }