Ejemplo n.º 1
0
        //Меню для таблиці Response
        static void ResponseMenu(int Id, int idUser, int goodId)
        {
            ResponseService responseService = new ResponseService();

            responseService.Get(Id);

            if (idUser == 1)
            {
                while (true)
                {
                    Console.WriteLine("What do you want to do next?");
                    Console.WriteLine("1 - search\n 2 - sort\n 3 - return to goods");

                    int responseNumber = responseService.GetResponce();
                    Console.Clear();

                    if (responseNumber == 1)
                    {
                        responseService.SearchResponse();
                        break;
                    }
                    else if (responseNumber == 2)
                    {
                        responseService.SortResponse();
                        break;
                    }
                    else if (responseNumber == 3)
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("You have entered wrong number please enter again");
                    }
                    Console.Clear();
                }
            }
            else
            {
                while (true)
                {
                    Console.WriteLine("What do you want to do next?");
                    Console.WriteLine("1 - add\n 2 - change\n 3 - delete\n 4 - return to good");
                    int responseNumber = responseService.GetResponce();
                    Console.Clear();

                    if (responseNumber == 1)
                    {
                        Console.WriteLine("Enter response: ");
                        string responseName = Console.ReadLine();
                        responseService.Create(idUser, goodId, responseName);
                        responseService.Save();
                        break;
                    }
                    else if (responseNumber == 2)
                    {
                        responseService.Get(idUser);
                        Console.WriteLine("Please enter id of response which you want to change");
                        int responseId = CheckNumber();
                        Console.WriteLine("Enter new response : ");
                        string name = Console.ReadLine();
                        responseService.Change(responseId, name);
                        Console.Clear();
                        break;
                    }
                    else if (responseNumber == 3)
                    {
                        responseService.Get(idUser);
                        Console.WriteLine("Please enter id of response which you want to delete");
                        int responseId = CheckNumber();
                        responseService.Delete(responseId);
                        Console.Clear();
                        break;
                    }
                    else if (responseNumber == 4)
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("You have entered wrong number please enter again");
                        Console.Clear();
                    }
                }
            }
        }