public void AddTask(string taskName, string taskAssignee, string taskDueDate, string TaskDescription) { var task = new BoardTask(); task.Name = taskName; task.AssignedToID = taskAssignee; task.DueDate = (!String.IsNullOrEmpty(taskDueDate)) ? DateTime.Parse(taskDueDate) : (DateTime?)null; task.Description = TaskDescription; task.SprintId = GetActiveSprint((int)_projectId); task.CreatedDate = DateTime.Now; //Put in first column var columns = this.GetColumns(); var column = columns.OrderBy(c => c.Id).First(); task.ColumnId = column.Id; _db.BoardTasks.Add(task); _db.SaveChanges(); if (column.Tasks.Count == 0) { List<BoardTask> tasks = new List<BoardTask>(); column.Tasks = tasks; } column.Tasks.Add(task); }
private void UpdateTask(BoardTask task) { _db.Entry(task).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); }