/// <summary> /// Update gantt tasks /// </summary> /// <param name="ganttData">GanttData object</param> private void UpdateTasks(GanttRequest ganttData) { switch (ganttData.Action) { case GanttAction.Inserted: // add new gantt task entity //db.Tasks.Add(ganttData.UpdatedTask); TasksRepository.Insert(ganttData.UpdatedTask); break; case GanttAction.Deleted: // remove gantt tasks //db.Tasks.Remove(db.Tasks.Find(ganttData.SourceId)); TasksRepository.Delete(ganttData.UpdatedTask); break; case GanttAction.Updated: // update gantt task //db.Entry(db.Tasks.Find(ganttData.UpdatedTask.Id)).CurrentValues.SetValues(ganttData.UpdatedTask); TasksRepository.Update(ganttData.UpdatedTask); break; default: ganttData.Action = GanttAction.Error; break; } }
public ActionResult Create(Task task) { TasksRepository repo = new TasksRepository(); repo.Insert(task); return(RedirectToAction("List", new { id = task.UserID })); }
public JsonResult Create() { var tasks = this.DeserializeObject <IEnumerable <TaskViewModel> >("models"); if (tasks != null) { foreach (var task in tasks) { TasksRepository.Insert(task); } } return(this.Jsonp(tasks)); }
public int CreateTask(Model.Contracts.Task task) { var res = tasksRepository.Insert(task.AutoMapObject <Model.Contracts.Task, DB.Task>()); return(res.TaskId); }