public EventAppointmentOnlineListModel Create(IEnumerable <EventSchedulingSlot> appointmentSlots)
        {
            var modal = new EventAppointmentOnlineListModel();

            if (appointmentSlots != null && appointmentSlots.Any())
            {
                var appointmentSlotList = appointmentSlots.ToList();
                var onlineSlots         = new List <EventAppointmentOnlineModel>();
                appointmentSlotList.ForEach(x => onlineSlots.Add(new EventAppointmentOnlineModel
                {
                    AppointmentId     = x.Id,
                    AppointmentStatus = x.Status,
                    EndTime           = x.EndTime,
                    StartTime         = x.StartTime
                }));

                var morningEndTime = appointmentSlotList.First().StartTime.Date.AddHours(12);
                modal.MorningSlots = onlineSlots.OrderBy(x => x.StartTime).Where(x => x.StartTime < morningEndTime);
                var afterNoonEndTime = appointmentSlotList.First().StartTime.Date.AddHours(16);
                modal.AfterNoonSlots = onlineSlots.OrderBy(x => x.StartTime).Where(x => x.StartTime >= morningEndTime && x.StartTime < afterNoonEndTime);
                modal.EveningSlots   = onlineSlots.OrderBy(x => x.StartTime).Where(x => x.StartTime >= afterNoonEndTime);
            }
            else
            {
                modal.MorningSlots   = new List <EventAppointmentOnlineModel>();
                modal.AfterNoonSlots = new List <EventAppointmentOnlineModel>();
                modal.EveningSlots   = new List <EventAppointmentOnlineModel>();
            }

            return(modal);
        }
        public EventAppointmentOnlineListModel SaveEventAppointmentSlotOnline(EventAppointmentOnlineListModel model)
        {
            var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(model.Guid);

            if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid)
            {
                return new EventAppointmentOnlineListModel()
                       {
                           RequestValidationModel = onlineRequestValidationModel
                       }
            }
            ;

            onlineRequestValidationModel.TempCart.AppointmentId = model.SelectedSlotId;
            model = _onlineAppointmentService.SaveEventAppointmentSlotOnline(onlineRequestValidationModel.TempCart);
            model.RequestValidationModel = onlineRequestValidationModel;

            return(model);
        }
    }