/*
         * Generate POST HTTP request to the API and return the queue position of the client.
         */
        public async Task <EnqueuePositionResult> RegisterToQueueAsync(EnqueuePosition requestPosition)
        {
            EnqueuePositionResult positionResult = null;

            HttpResponseMessage response = await client.PostAsJsonAsync($"{ConstantURI.queueServerURI}Queue", requestPosition);

            response.EnsureSuccessStatusCode();

            positionResult = await response.Content.ReadAsAsync <EnqueuePositionResult>();

            return(positionResult);
        }
Example #2
0
        public async Task <IActionResult> Add([FromBody] EnqueuePosition item)
        {
            if (item is null || item.ServiceType == ServiceType.none)
            {
                return(BadRequest());
            }

            EnqueuePositionResult result = await _queueService.AddToQueue(item);

            if (result is null)
            {
                return(Conflict());
            }
            return(CreatedAtAction(nameof(Add), result));
        }
        public void ExecuteEnterNurseQueueCommandAsync_EnterUserToNurseQueue_SetModelNumber()
        {
            //Arrange
            SelectQueueComponentViewModel viewModel = new SelectQueueComponentViewModel(eventAggregator, httpService, dialogService);

            viewModel.Model = new Patient()
            {
                ClientCard = new CardInfo()
                {
                    CardNumber = 200
                }, CustomerID = 1
            };
            EnqueuePositionResult expected = new EnqueuePositionResult()
            {
                UserNumber = 1
            };

            //Act
            viewModel.EnterNurseQueueCommand.Execute();

            //Assert
            Assert.AreEqual(expected.UserNumber, viewModel.Model.LineNumber.UserNumber);
        }
Example #4
0
        public MockRepository()
        {
            customerMockup = new Dictionary <CardInfo, CustomerIdentification>()
            {
                { new CardInfo()
                  {
                      CardNumber = 200
                  }, new CustomerIdentification()
                  {
                      CustomerId = 1
                  } },
                { new CardInfo()
                  {
                      CardNumber = 300
                  }, new CustomerIdentification()
                  {
                      CustomerId = 2
                  } },
                { new CardInfo()
                  {
                      CardNumber = 400
                  }, new CustomerIdentification()
                  {
                      CustomerId = 3
                  } },
                { new CardInfo()
                  {
                      CardNumber = 500
                  }, new CustomerIdentification()
                  {
                      CustomerId = 4
                  } },
                { new CardInfo()
                  {
                      CardNumber = 600
                  }, new CustomerIdentification()
                  {
                      CustomerId = 5
                  } },
                { new CardInfo()
                  {
                      CardNumber = 700
                  }, new CustomerIdentification()
                  {
                      CustomerId = 6
                  } },
                { new CardInfo()
                  {
                      CardNumber = 800
                  }, new CustomerIdentification()
                  {
                      CustomerId = 7
                  } },
                { new CardInfo()
                  {
                      CardNumber = 900
                  }, new CustomerIdentification()
                  {
                      CustomerId = 8
                  } },
                { new CardInfo()
                  {
                      CardNumber = 1000
                  }, new CustomerIdentification()
                  {
                      CustomerId = 9
                  } }
            };

            schedules = new List <ScheduleModel>()
            {
                new ScheduleModel()
                {
                    Day = DayOfWeek.Sunday, Type = ServiceType.Nurse, WorkingHours = new WorkingWindow()
                    {
                        StartTime = TimeSpan.FromHours(0), EndTime = TimeSpan.FromHours(24)
                    }
                },
                new ScheduleModel()
                {
                    Day = DayOfWeek.Sunday, Type = ServiceType.Pharmacist, WorkingHours = new WorkingWindow()
                    {
                        StartTime = TimeSpan.FromHours(0), EndTime = TimeSpan.FromHours(24)
                    }
                },

                new ScheduleModel()
                {
                    Day = DayOfWeek.Monday, Type = ServiceType.Pharmacist, WorkingHours = new WorkingWindow()
                    {
                        StartTime = TimeSpan.FromHours(0), EndTime = TimeSpan.FromHours(0)
                    }
                },
                new ScheduleModel()
                {
                    Day = DayOfWeek.Monday, Type = ServiceType.Nurse, WorkingHours = new WorkingWindow()
                    {
                        StartTime = TimeSpan.FromHours(0), EndTime = TimeSpan.FromHours(0)
                    }
                }
            };

            positionResult = new EnqueuePositionResult()
            {
                UserNumber = 1
            };
        }