Advertisement
BSO90

Untitled

Aug 6th, 2021
1,247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using TaskManegementSystemOperations.Commands;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using TaskManegementSystemCore;
  6. using TaskManegementSystemModels.Interfaces;
  7. using System.Linq;
  8.  
  9. namespace TaskManegementSystemOperations
  10. {
  11.     public class Show_All_Team_Boards : ICommand
  12.     {
  13.         private readonly Repository repository;
  14.         public Show_All_Team_Boards( Repository repository)
  15.         {
  16.             this.repository = repository;
  17.         }
  18.         public string Execute(IList<string> parameters)
  19.         {
  20.             if (parameters.Count != 0)
  21.             {
  22.                 throw new ArgumentException("Please write only the command!");
  23.             }
  24.             Console.WriteLine();//TODO: console message
  25.             string teamName = Console.ReadLine();
  26.             return ShowAllTeamBoard(teamName);
  27.         }
  28.  
  29.         public string ShowAllTeamBoard(string teamName)
  30.         {
  31.             ITeam team = repository.Teams.FirstOrDefault(x => x.Name == teamName);
  32.             StringBuilder str = new StringBuilder();
  33.             foreach (string board in team.BoardNames)
  34.             {
  35.                 int counter = 1;
  36.                 str.AppendLine($"{counter++}. {board}");
  37.             }
  38.  
  39.             return str.ToString().Trim();
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement