/**/ /* * NAME: * AddTaskUserUpdate - adds a TaskUserUpdate entry to the database * SYNOPSIS: * AddTaskUserUpdate(TaskUserUpdate taskUserUpdate) * taskUserUpdate --> the taskUserUpdate object to be added to the database * DESCRIPTION: * Accesses the database context in order to add the new TaskUserUpdate object * RETURNS * AUTHOR * Biplab Thapa Magar * DATE * 09/12/2020 * / * /**/ public void AddTaskUserUpdate(TaskUserUpdate taskUserUpdate) { if (taskUserUpdate == null) { throw new ArgumentNullException(nameof(taskUserUpdate)); } _context.Add(taskUserUpdate); }
/**/ /* * NAME: * RemoveUserFromTask - unassigns a user from a task * SYNOPSIS: * RemoveUserFromTask(TaskUser taskUser, string updaterId) * taskUser --> the TaskUser object that represents the user's assignment to a task * updaterId --> the id of the user who is removing the user from the task * DESCRIPTION: * Accesses the database context in order to unassign the user from the task * RETURNS * AUTHOR * Biplab Thapa Magar * DATE * 09/06/2020 * / * /**/ public void RemoveUserFromTask(TaskUser taskUser, string updaterId) { //create a TaskUserUpdate entry var taskUserUpdate = new TaskUserUpdate { TaskId = taskUser.TaskId, AppUserId = taskUser.AppUserId, UpdaterId = updaterId, TimeRemoved = DateTime.Now }; _context.TaskUsers.Remove(taskUser); AddTaskUserUpdate(taskUserUpdate); }
/**/ /* * NAME: * AssignUserToTask - assigns a user to a task * SYNOPSIS: * AssignUserToTask(TaskUser taskUser, string updaterId) * taskUser --> the TaskUser object that represents the user's assignment to a task * updaterId --> the id of the user who assigned the user to the task * DESCRIPTION: * Accesses the database context in order to assign the user to the task * RETURNS * AUTHOR * Biplab Thapa Magar * DATE * 09/06/2020 * / * /**/ public void AssignUserToTask(TaskUser taskUser, string updaterId) { if (taskUser == null) { throw new ArgumentNullException(nameof(taskUser)); } //create a TaskUserUpdate entry as well var TaskUserUpdate = new TaskUserUpdate { TaskId = taskUser.TaskId, AppUserId = taskUser.AppUserId, UpdaterId = updaterId, TimeAdded = DateTime.Now }; _context.Add(taskUser); AddTaskUserUpdate(TaskUserUpdate); }