Esempio n. 1
0
        public IActionResult Index()
        {
            _logger.LogInfo($"Zapytanie do metody Index()");

            DisplayErrorFromRedirectIfNecessary();

            var result = _doctorRepo.Get();

            if (!result.IsSuccess)
            {
                AddLocalError(result.FailureMessage);
                return(View(Enumerable.Empty <DoctorViewModel>()));
            }

            var model = Mapper.Map <IEnumerable <DoctorViewModel> >(result.Value);

            return(View(model));
        }
Esempio n. 2
0
        public Result <IEnumerable <DoctorSelectViewModel> > GetDoctorSelectList()
        {
            return(Try(() =>
            {
                var result = _doctorRepo.Get();

                if (!result.IsSuccess)
                {
                    throw new Exception(result.FailureMessage);
                }

                return Map <IEnumerable <DoctorSelectViewModel> >(result.Value.Where(x => x.HasValidMedicalLicense));
            }, GetType()));
        }
Esempio n. 3
0
        public IActionResult Get(int id)
        {
            var result = _doctorRepo.Get(id);

            return(Ok(result));
        }