public void SaveOrUpdate(Sprint sprint, string userId) { if (sprint.Id > 0) { Update(sprint); } else { Add(sprint, userId); } }
public void Delete(Sprint sprint) { var exist = Get(sprint); if (exist.UserStories.ToList().Any()) { throw new BadRequestException("This story is shared between user stories"); } db.Sprints.Remove(exist); db.SaveChanges(); }
private void SaveToHistory(Sprint sprint, string userId) { SprintHistory history = new SprintHistory() { sprintId = sprint.Id, closedBy = userId, closeDate = DateTime.Now, version = int.Parse(sprint.version.ToString()) }; db.SprintHistories.Add(history); db.SaveChanges(); }