Exemple #1
0
 public IActionResult DiagnoseHistory(DiagnoseHistoryViewModel viewModel)
 {
     return(RedirectToAction(nameof(DiagnoseHistory), new
     {
         Id = viewModel.PacientId,
         diagnoseId = viewModel.DiagnoseId,
         returnUrl = viewModel.ReturnUrl,
         search = viewModel.Search
     }));
 }
Exemple #2
0
        public async Task <IActionResult> DiagnoseHistory(string Id, int?diagnoseId,
                                                          string returnUrl, string search)
        {
            var card = await _cardService.GetCardByIdAsync(Id);

            var vm = new DiagnoseHistoryViewModel
            {
                DiagnoseId = diagnoseId,
                PacientId  = Id,
                ReturnUrl  = returnUrl,
                Search     = search,
            };

            if (diagnoseId.HasValue)
            {
                vm.Diagnose = await _cardService.GetDiagnoseById(diagnoseId.Value, true);

                if (!string.IsNullOrEmpty(search))
                {
                    vm.History = await _cardService.SearchDiagnosesHistories(diagnoseId.Value, search)
                                 .OrderBy(x => x.ConclusionDate).Include(x => x.Doctor).ToArrayAsync();
                }
                else
                {
                    vm.History = await _cardService.GetDiagnosesHistories(diagnoseId.Value)
                                 .OrderBy(x => x.ConclusionDate).Include(x => x.Doctor).ToArrayAsync();
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(search))
                {
                    vm.History = await _cardService.SearchDiagnoseHistories(card.Id, search)
                                 .OrderBy(x => x.ConclusionDate).Include(x => x.Diagnose).ToArrayAsync();
                }
                vm.History = await _cardService.GetDiagnoseHistories(card.Id)
                             .OrderBy(x => x.ConclusionDate).Include(x => x.Diagnose).ToArrayAsync();
            }

            return(View(vm));
        }