public Position AddNewPosition(string title) { if (GetAllPositions().Any(x => x.Title.Matches(title))) throw new InvalidOperationException(string.Format("A position with the title {0} already exists", title)); var position = new Position { Title = title }; position.Validate(); return Persist<Position>(position); }
public void SetHirePositions(IEnumerable<Position> hirePositions, Position currentPosition) { var hirePositionsList = hirePositions.Select(x => new SelectListItem { Text = x.Title, Value = x.Id.Value.ToString(), Selected = x == currentPosition }).OrderBy(x => x.Text).ToList(); hirePositionsList.Insert(0,new SelectListItem() { Text = "--Please Choose--", Value = "", Selected = false }); HirePositions = hirePositionsList; }