public int GetIdeationScore(int ideationId) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation != null) { return(ideation.GetScore()); } throw new ArgumentException("Ideation not found."); }
public void AddVoteToIdeation(Vote vote, int ideationId) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation == null) { throw new ArgumentException("Ideation not found."); } vote.Ideation = ideation; ideation.Votes.Add(vote); _ideationRepository.UpdateIdeation(ideation); }
public Domain.Ideation.Ideation ChangeIdeationState(int id, bool newState) { Domain.Ideation.Ideation toChange = GetIdeation(id); if (toChange != null) { toChange.IsOpen = newState; Validate(toChange); return(_ideationRepository.UpdateIdeation(toChange)); } throw new ArgumentException("Ideation not found.", "id"); }
public Domain.Ideation.Ideation AddIdeation(string title, int projectPhaseId) { ProjectPhase phase = _projectManager.GetProjectPhase(projectPhaseId); if (phase == null) { throw new ArgumentException("Project phase not found."); } Domain.Ideation.Ideation ideation = new Domain.Ideation.Ideation() { Title = title, ProjectPhase = phase }; return(AddIdeation(ideation)); }
public Field AddFieldToIdeation(FieldType type, string content, int ideationId) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation == null) { throw new ArgumentException("Ideation not found.", "ideationId"); } Field field = new Field() { Content = content, FieldType = type, Ideation = ideation }; return(AddField(field)); }
public Domain.Ideation.Ideation ChangeIdeation(int id, string title, int projectPhaseId) { Domain.Ideation.Ideation toChange = GetIdeation(id); if (toChange != null) { ProjectPhase phase = _projectManager.GetProjectPhase(projectPhaseId); if (phase == null) { throw new ArgumentException("Project phase not found", "projectPhaseId"); } toChange.Title = title; toChange.ProjectPhase = phase; Validate(toChange); return(_ideationRepository.UpdateIdeation(toChange)); } throw new ArgumentException("Ideation not found.", "id"); }
public Idea ChangeIdea(int id, string title, int ideationId) { Idea toChange = GetIdea(id); if (toChange != null) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation == null) { throw new ArgumentException("Ideation not found.", "ideationId"); } toChange.Title = title; toChange.Ideation = ideation; Validate(toChange); return(_ideaRepository.UpdateIdea(toChange)); } throw new ArgumentException("Idea not found.", "id"); }
public Idea AddIdea(string title, int ideationId) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation == null) { throw new ArgumentException("Ideation not found."); } if (!ideation.IsOpen) { throw new ArgumentException("Ideation is not open for new ideas."); } Idea idea = new Idea() { Title = title, Ideation = ideation }; return(AddIdea(idea)); }
public Field ChangeIdeationField(int id, FieldType type, string content, int ideationId) { Field toChange = GetField(id); if (toChange != null) { Domain.Ideation.Ideation ideation = GetIdeation(ideationId); if (ideation == null) { throw new ArgumentException("Ideation not found.", "ideationId"); } toChange.FieldType = type; toChange.Content = content; toChange.Ideation = ideation; Validate(toChange); return(_fieldRepository.UpdateField(toChange)); } throw new ArgumentException("Field not found.", "id"); }
private Domain.Ideation.Ideation AddIdeation(Domain.Ideation.Ideation ideation) { Validate(ideation); return(_ideationRepository.CreateIdeation(ideation)); }
/** * Helper method to validate the object we want to persist against the validation annotations. * Will throw a ValidationException upon failing. */ private void Validate(Domain.Ideation.Ideation ideation) { Validator.ValidateObject(ideation, new ValidationContext(ideation), true); }