Пример #1
0
        public IActionResult GetAllCertificate()
        {
            var certificate = certificateRepository.GetAll();
            var viewModel   = mapper.Map <List <MedicineCertificateViewModel> >(certificate);

            return(View(viewModel));
        }
Пример #2
0
        public IActionResult GetAllCertificate(string position, DateTime?dateOfIssue)
        {
            if (!string.IsNullOrWhiteSpace(position))
            {
                var byPosition = certificateRepository.GetCertificateByPosition(position);
                var viewModel  = mapper.Map <List <MedicineCertificateViewModel> >(byPosition);

                return(View(viewModel));
            }
            else if (dateOfIssue != null)
            {
                var byDate    = certificateRepository.GetCertificateByDate(dateOfIssue);
                var viewModel = mapper.Map <List <MedicineCertificateViewModel> >(byDate);

                return(View(viewModel));
            }
            else
            {
                var certificate = certificateRepository.GetAll();
                var viewModel   = mapper.Map <List <MedicineCertificateViewModel> >(certificate);

                return(View(viewModel));
            }
        }