/// <summary> /// /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult UpdateScheduleTask(UpdateScheduleTaskDto dto) { using (var client = DbFactory.CreateClient()) { var scheduleTask = client.Queryable <ScheduleTask>().InSingle(dto.Id); if (scheduleTask == null) { return(Error("找不到该条信息")); } if (scheduleTask.IsEnable) { return(Error("请先关闭定时任务再删除")); } scheduleTask.Name = dto.Name; scheduleTask.Cron = dto.Cron; client.Updateable(scheduleTask).UpdateColumns(t => new { t.Name, t.Cron }).ExecuteCommand(); _eventPublisher.EntityUpdated(scheduleTask); return(Ok()); } }
public IActionResult Update(UpdateScheduleTaskDto dto) { var result = _scheduleTaskService.UpdateScheduleTask(dto); return(Json(result)); }