public async Task <JsonResult> UpdateTask(int id, TaskIn model) { var notify = false; var task = ContentService.Get <TaskItem>(model.Id); if (model.AssignedTo.HasValue && model.AssignedTo != task.AssignedTo && model.AssignedTo != User.Id) { notify = true; } task.Name = model.Name; task.Description = model.Description; task.Completed = model.Completed; task.DueDate = model.DueDate; task.AssignedTo = model.AssignedTo; task.Priority = model.Priority; var updated = ContentService.Update <TaskItem>(task); // notify if (notify) { NotificationService.Insert( new Notification(model.AssignedTo.Value, $@"{User.GetTitle()} assigned you to the task <strong>{task.Name}</strong>") { Link = task } ); } // push realtime event await PushService.Push("task_updated", task); return(Json(updated)); }
public ActionResult TaskIn(string fileName) //Excel导入教学信息 { myTBsys.TaskIn taskIn = new TaskIn(); taskIn.Click(fileName); db.SaveChanges(); return(RedirectToAction("DataIn")); }
public async Task <JsonResult> InsertTask(int id, TaskIn model) { var app = GetApp(id); var task = ContentService.Insert <TaskItem>(new TaskItem { Name = model.Name }, app); // push realtime event await PushService.Push("task_inserted", task); // return json return(Json(task)); }