public void addUser(User user) { using (var context = new ThemisContext()) { context.Users.Add(user); context.SaveChanges(); } }
public UserStory AddUserStory(UserStory story) { using (var context = new ThemisContext()) { context.UserStories.Add(story); context.SaveChanges(); } return(story); }
public User DeleteInvitation(String projectName, String invitedUser) { using (var context = new ThemisContext()) { var declinedInvitation = context.Invitation.Where(i => i.username.Equals(invitedUser) && i.Name.Equals(projectName)); context.Invitation.Remove(declinedInvitation.FirstOrDefault()); context.SaveChanges(); return(context.Users.Find(invitedUser)); } }
public Sprint CreateSprint(string projectName, int number) { using (var context = new ThemisContext()) { context.Sprints.Add(new Sprint() { Name = projectName, Number = number }); context.SaveChanges(); return(GetSprint(projectName, number)); } }
public UserStory[] EditDescription(string projectName, string oldDescription, string newDescription) { using (var context = new ThemisContext()) { var userStory = context.UserStories.Where(u => u.Name.Equals(projectName) && u.Description.Equals(oldDescription)).FirstOrDefault(); if (userStory != null) { userStory.Description = newDescription; } context.Entry(userStory).State = EntityState.Modified; context.SaveChanges(); return(GetUserStoriesForProject(projectName)); } }
public User AddInvitation(string projectName, string invitedUser) { using (var context = new ThemisContext()) { var invitation = new InvitationModel() { Name = projectName, username = invitedUser }; context.Invitation.Add(invitation); context.SaveChanges(); return(context.Users.Find(invitedUser)); } }
public BackLogItem SetSprintId(int backlogId, int sprintId) { using (var context = new ThemisContext()) { var backlogItem = context.BackLogItems.Find(backlogId); if (backlogItem != null) { backlogItem.SprintId = sprintId; } context.Entry(backlogItem).State = EntityState.Modified; context.SaveChanges(); return(backlogItem); } }
public BackLogItem EditDescription(int backlogId, string newDescription) { using (var context = new ThemisContext()) { var backlog = context.BackLogItems.Find(backlogId); if (backlog != null) { backlog.Description = newDescription; } context.Entry(backlog).State = EntityState.Modified; context.SaveChanges(); return(backlog); } }
public Sprint SetActualTime(int backlogId, int actualTime) { using (var context = new ThemisContext()) { var backlog = context.BackLogItems.Find(backlogId); if (backlog != null) { backlog.ActualTime = actualTime; backlog.Status = "Done"; } context.Entry(backlog).State = EntityState.Modified; context.SaveChanges(); var sprint = AssembleSprintById(backlog.SprintId); return(sprint); } }
//Set a scrum master and removes the developer from the developers table public Project SetScrumMaster(string username, string projectName) { using (var context = new ThemisContext()) { User user = context.Users.Find(username); WorkGroup workgroup = assembleWorkGroup(projectName); var wgDevs = context.WorkGroupDevelopers.Where(w => w.Developer.username.Equals(username) && w.WorkGroupId.Equals(workgroup.WorkGroupId)).FirstOrDefault(); workgroup.ScrumMaster = user; context.WorkGroupDevelopers.Remove(wgDevs); context.Entry(workgroup).State = EntityState.Modified; context.SaveChanges(); return(assembleProject(projectName)); } }
public Project AcceptInvitation(String projectName, String invitedUser) { using (var context = new ThemisContext()) { var user = context.Users.Find(invitedUser); var AcceptedInvitation = context.Invitation.Where(i => i.username.Equals(invitedUser) && i.Name.Equals(projectName)); var workGroupId = context.WorkGroups.Where(w => w.Name.Equals(projectName)).Select(w => w.WorkGroupId).FirstOrDefault(); context.WorkGroupDevelopers.Add(new WorkGroupDeveloper() { WorkGroupId = workGroupId, Developer = user }); context.Invitation.Remove(AcceptedInvitation.FirstOrDefault()); context.SaveChanges(); return(context.Projects.Find(projectName)); } }
public Sprint SetWorkingUser(int backlogId, string username) { using (var context = new ThemisContext()) { var backlog = context.BackLogItems.Find(backlogId); var user = context.Users.Find(username); if (backlog != null) { backlog.WorksOnIt = user; backlog.Status = "Being done"; } context.Entry(backlog).State = EntityState.Modified; context.SaveChanges(); var sprint = AssembleSprintById(backlog.SprintId); return(sprint); } }
public void CreateBacklogItem(BackLogItem backlog) { using (var context = new ThemisContext()) { var backlogItem = new BackLogItem() { Name = backlog.Name, SprintId = null, Status = "Not done", Description = backlog.Description, Priority = backlog.Priority, EstimatedTime = backlog.EstimatedTime }; context.BackLogItems.Add(backlogItem); context.SaveChanges(); } }
public void addProject(string projectName, string username) { using (var context = new ThemisContext()) { var query = from p in context.Projects where p.Name.Equals(projectName) select p.Name; if (!query.Equals(projectName)) { context.Projects.Add(new Project(projectName) { Name = projectName }); var temp = context.Users.Find(username); context.WorkGroups.Add(new WorkGroup() { Name = projectName, Creator = temp }); context.SaveChanges(); } } }
//Updates exsisting product owner and returns the old one to the developers table public Project UpdateExistingProductOwner(string username, string projectName) { using (var context = new ThemisContext()) { User user = context.Users.Find(username); WorkGroup workgroup = assembleWorkGroup(projectName); var oldProductOwner = context.Users.Find(workgroup.ProductOwner.username); var wgDevs = context.WorkGroupDevelopers.Where(w => w.Developer.username.Equals(username) && w.WorkGroupId.Equals(workgroup.WorkGroupId)).FirstOrDefault(); workgroup.ProductOwner = user; context.WorkGroupDevelopers.Remove(wgDevs); context.WorkGroupDevelopers.Add(new WorkGroupDeveloper() { WorkGroupId = workgroup.WorkGroupId, Developer = oldProductOwner }); context.Entry(workgroup).State = EntityState.Modified; context.SaveChanges(); return(assembleProject(projectName)); } }