Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using TaskManegementSystemOperations.Commands;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using TaskManegementSystemCore;
- using TaskManegementSystemModels.Interfaces;
- namespace TaskManegementSystemOperations
- {
- public class Show_All_Teams : ICommand
- {
- private readonly Repository repository;
- public Show_All_Teams(Repository repository)
- {
- this.repository = repository;
- }
- public string Execute(IList<string> parameters)
- {
- if (parameters.Count != 0)
- {
- throw new ArgumentException("Please write only the command!");
- }
- return ShowAllTeams();
- }
- public string ShowAllTeams()
- {
- StringBuilder str = new StringBuilder();
- foreach (ITeam team in repository.Teams)
- {
- int count = 1;
- str.AppendLine($"{count++}. {team.Name}");
- }
- return str.ToString().Trim();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement