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 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 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 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); } }
//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)); } }