示例#1
0
        private ServiceServices CreateServiceService()
        {
            var userId         = Guid.Parse(User.Identity.GetUserId());
            var serviceService = new ServiceServices(userId);

            return(serviceService);
        }
示例#2
0
        public IHttpActionResult Get()
        {
            ServiceServices serviceService = CreateServiceService();
            var             services       = serviceService.GetServices();

            return(Ok(services));
        }
示例#3
0
        public void ChooseActionForService()
        {
            ServiceRepository serviceRepository = new ServiceRepository();
            ServiceServices   serviceServices   = new ServiceServices();

            Console.Clear();
            Console.WriteLine("Repository: SERVICE\n\n");
            Console.WriteLine("What action you want to choose?\n" +
                              "1. View table\n" +
                              "2. Add row\n" +
                              "3. Update row\n" +
                              "4. Delete row\n" +
                              "5. View maximum price\n" +
                              "6. Viev minimum price\n" +
                              "7. Back to start menu");
            Console.Write("\nYour selection: ");

            string ch = Console.ReadLine();

            switch (ch)
            {
            case "1":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    serviceRepository.Select(serviceRepository.CreateFilter());
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "2":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    serviceRepository.Add(serviceRepository.CreateModel());
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "3":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    serviceRepository.Update(serviceRepository.CreateModel(), serviceRepository.CreateFilter());
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "4":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    serviceRepository.Delete(serviceRepository.CreateFilter());
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "5":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    Console.WriteLine("MaxPrice: " + serviceServices.MaxPrice());
                    Console.ReadKey();
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "6":
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("Repository: SERVICE\n\n");
                    Console.WriteLine("MinPrice: " + serviceServices.MinPrice());
                    Console.ReadKey();
                    break;
                }
                finally
                {
                    Menu menu = new Menu();
                    menu.ChooseActionForService();
                }
            }

            case "7":
            {
                Menu menu = new Menu();
                menu.ChooseTable();
                break;
            }

            default:
                Console.WriteLine("Invalid selection. Please select 1, 2, 3, 4 or 5.");
                break;
            }
        }