public int Create(string listName) { List newList = new List { ListName = listName, CreatedDate = DateTime.Now }; _ternContext.Lists.Add(newList); _ternContext.SaveChanges(); return(newList.ListId); }
public int Delete(int taskId) { Domain.Task task = new Domain.Task { TaskId = taskId }; _ternContext.Tasks.Attach(task); _ternContext.Tasks.Remove(task); int rowAffected = _ternContext.SaveChanges(); return(rowAffected); }
public int UpdateTitle(int subTaskId, string title) { int rowAffected = 0; SubTask subTask = _ternContext.SubTasks.FirstOrDefault(x => x.SubTaskId == subTaskId); if (subTask != null) { subTask.SubTaskName = title; _ternContext.SubTasks.Update(subTask); rowAffected = _ternContext.SaveChanges(); } return(rowAffected); }
public int UpdateStatus(int taskId, int statusId) { int rowAffected = 0; Task task = _ternContext.Tasks.FirstOrDefault(x => x.TaskId == taskId); if (task != null) { task.StatusId = statusId; _ternContext.Tasks.Update(task); rowAffected = _ternContext.SaveChanges(); } return(rowAffected); }
public int Update(int listId, string listName) { int rowAffacted = 0; List list = _ternContext.Lists.FirstOrDefault(x => x.ListId == listId); if (list != null) { list.ListName = listName; _ternContext.Lists.Update(list); rowAffacted = _ternContext.SaveChanges(); } return(rowAffacted); }
public int MoveToList(int taskId, int listId) { int recordAffected = 0; Task task = _ternContext.Tasks.FirstOrDefault(x => x.TaskId == taskId); if (task != null) { task.ListId = listId; _ternContext.Tasks.Update(task); recordAffected = _ternContext.SaveChanges(); } return(recordAffected); }