Exemplo n.º 1
0
        public IActionResult ScheduleDate(int year, int month, int day)
        {
            var doctor   = doctorService.GetDoctor(User.Identity.Name);
            var date     = new DateTime(year, month, day);
            var daySched = scheduleService.GetDoctorDaySchedule(date, doctor.Id);
            var model    = new ScheduleDayViewModel()
            {
                ScheduleDay = daySched,
                Date        = date
            };

            ViewBag.IsPlaceDefaultExist = !string.IsNullOrEmpty(doctor.PlaceDefault);
            return(View(model));
        }
Exemplo n.º 2
0
        public IActionResult ScheduleSearch(string date, Guid classId)
        {
            if (!DateTime.TryParse(date, out var dateTime))
            {
                return(null);
            }
            var models    = _scheduleService.ScheduleSearch(dateTime, classId);
            var viewModel = new ScheduleDayViewModel();

            viewModel.ScheduleModels = models;
            viewModel.Date           = dateTime;
            viewModel.ClassId        = classId;
            return(View(viewModel));
        }
Exemplo n.º 3
0
        public IActionResult ScheduleDate(int year, int month, int day, Guid specializationId)
        {
            var date     = new DateTime(year, month, day);
            var daySched = scheduleService.GetDaySchedule(date, specializationId);
            var model    = new ScheduleDayViewModel()
            {
                ScheduleDay       = daySched,
                Date              = date,
                SpecialiazationId = specializationId,
                Specialiazation   = commonSerivce.GetSpecialization(specializationId).Name
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public IActionResult DaySchedule(int year, int month, int day)
        {
            var dayDate = new DateTime(year, month, day);
            var role    = GetUserRole();

            Guid?entityId = null;

            if (role != "Admin")
            {
                entityId = _userService.GetUser(User.Identity.Name).Id;
            }

            var scheduleModels = _scheduleService.GetSchedulesByDay(dayDate, role, entityId);

            var viewModel = new ScheduleDayViewModel();

            viewModel.ScheduleModels = scheduleModels;
            viewModel.Date           = dayDate;

            return(View(viewModel));
        }
        public static void AssertAreEqual(ScheduleDayViewModel expected, ScheduleDayViewModel actual, string messagePrefix = "")
        {
            if (expected == null && actual == null)
            {
                return;
            }

            Assert.IsFalse(expected == null || actual == null, $"{messagePrefix}Instance should not be null.");

            Assert.AreEqual(expected.Date, actual.Date, $"{messagePrefix}Date of game do not match");
            Assert.AreEqual(expected.Divisions.Count, actual.Divisions.Count, $"{messagePrefix}Number of Division entries does not match.");

            for (var i = 0; i < expected.Divisions.Count; i++)
            {
                DivisionTitleViewModelComparer.AssertAreEqual(expected.Divisions[i], actual.Divisions[i], $"{messagePrefix}[Division#{i}]");
            }

            Assert.AreEqual(expected.Games.Count, actual.Games.Count, $"{messagePrefix}Number of Game entries does not match.");

            for (var i = 0; i < expected.Games.Count; i++)
            {
                GameViewModelComparer.AssertAreEqual(expected.Games[i], actual.Games[i], $"{messagePrefix}[Game#{i}]");
            }
        }