public JsonResult GetListaAtendimentos(string codigoPaciente) { var agenda = new List <AgendaMedicaViewModel>(); try { agenda = _agendaService.GetAgendaMedica(codigoPaciente, CurrentUserID); Response.StatusCode = (int)HttpStatusCode.OK; } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } return(Json(agenda, JsonRequestBehavior.AllowGet)); }