public int CreateTask(Task_Tbl Task, int userID) { TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); tmdb.Task_Tbl.Add(Task); tmdb.SaveChanges(); if (userID > 0) { User_Tbl userDd = tmdb.User_Tbl.Where(u => u.User_ID == userID).FirstOrDefault(); User_Tbl user = new User_Tbl() { User_ID = userDd.User_ID, First_Name = userDd.First_Name, Last_Name = userDd.Last_Name, Task_ID = Task.Task_ID, Project_ID = Task.Project_ID, Employee_ID = userDd.Employee_ID }; user.Task_ID = Task.Task_ID; tmdb.Entry(userDd).CurrentValues.SetValues(user); tmdb.SaveChanges(); } updateTaskStatusPerProject(); return(Task.Task_ID); }
public int DeleteTask(int TaskID) { TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); Task_Tbl taskTbl = tmdb.Task_Tbl.Where(t => t.Task_ID == TaskID).FirstOrDefault(); tmdb.Task_Tbl.Remove(taskTbl); return(tmdb.SaveChanges()); }
//public int EditParentTask(int parentID, string parentName) //{ // TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); // Parent_Task_Tbl ParentTaskDb = tmdb.Parent_Task_Tbl.Find(parentID); // ParentTaskDb.Parent_Task = parentName; // tmdb.SaveChanges(); // return parentID; //} public int CreateTask(Task_Tbl Task) { TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); tmdb.Task_Tbl.Add(Task); tmdb.SaveChanges(); return(Task.Task_ID); }
public int EditEndTask(int taskID, bool IsCompleted) { TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); Task_Tbl TaskDb = tmdb.Task_Tbl.Find(taskID); TaskDb.Is_Completed = IsCompleted; tmdb.SaveChanges(); return(taskID); }
public int EditTask(Task_Tbl Task) { TaskManagerDbEntities tmdb = new TaskManagerDbEntities(); Task_Tbl TaskDb = tmdb.Task_Tbl.Find(Task.Task_ID); tmdb.Entry(TaskDb).CurrentValues.SetValues(Task); tmdb.SaveChanges(); return(Task.Task_ID); }