예제 #1
0
        // GET: Agenda
        public ActionResult Index(FiltroAgendamentoViewModel model)
        {
            if (model.DataAgendamento == null || model.DataAgendamento == default(DateTime))
            {
                model.DataAgendamento = DateTime.Now;
            }

            IEnumerable <ObterServicoViewModel> servicos = servicoService.ObterTodos();

            model.Servicos = servicos.Select(x => new SelectListItem {
                Text = x.Descricao, Value = x.IdServico.ToString()
            });
            model.Data = agendaService.GetAgendamentoPorData(model.DataAgendamento);

            IEnumerable <string> pendentes = agendaService.ObterAgendamentosPendentes(GetUserId());

            if (pendentes.Any())
            {
                string mensagemPendentes = $"Existem agendamentos pendentes para os seguintes serviços: {string.Join(",", pendentes)}";
                model.MensagemPendentes = mensagemPendentes;
            }

            return(View(model));
        }