public void GetDaftarPermohonan_expect_NotNull_actual_NotNull()
 {
     A.CallTo(() => unitWork.GetDaftarPermohonan(new pemohon()))
     .WithAnyArguments().Returns(
         new List <permohonan>());
     Assert.NotNull(service.GetPermohonans());
 }
        public async Task <IActionResult> Get()
        {
            try
            {
                var id   = UserManagers.GetUserId(User);
                var user = await User.GetPemohon(id);

                var service = new PermohonanService(user, new UOWPermohonan());
                var result  = service.GetPermohonans();
                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Beispiel #3
0
        private async void LoadAsync()
        {
            try
            {
                await Task.Delay(300);

                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;

                if (lastPermohonan == null)
                {
                    lastPermohonan = await PermohonanService.GetLastPermohonan();

                    CurrentItem = lastPermohonan;
                }

                if (CurrentItem != null)
                {
                    CurrentItem = await PermohonanService.GetPermohonanById(CurrentItem.Id);

                    var layanan = await LayananServices.GetItemAsync(CurrentItem.IdLayanan.ToString());

                    if (layanan != null)
                    {
                        StepBar.Steps = 0;
                        StepBar.Children.Clear();
                        StepBar.StepSelected = 0;
                        StepBar.Steps        = layanan.Tahapans.Count();

                        NextTahapan = null;
                        if (CurrentItem.NextTahapan != null)
                        {
                            NextTahapan = CurrentItem.NextTahapan;
                        }

                        ShowSertifikat = false;
                        if (CurrentItem.Tahapans != null && layanan.Tahapans.Count == CurrentItem.Tahapans.Count)
                        {
                            NextTahapan = new tahapan {
                                Nama = "Tidak Ada", Keterangan = "Proses Telah Selesai"
                            };
                            ShowSertifikat = true;

                            StepBar.Complete();
                        }

                        if (CurrentItem.CurrentTahapan != null && layanan.Tahapans.Count > CurrentItem.Tahapans.Count)
                        {
                            var c = layanan.Tahapans.Where(O => O.Id == CurrentItem.CurrentTahapan.Id).FirstOrDefault();
                            if (c != null)
                            {
                                var index = layanan.Tahapans.IndexOf(c);
                                StepBar.StepSelected = index + 1;
                            }
                        }
                    }
                }
                var result = await PermohonanService.GetPermohonans();

                Permohonans.Clear();
                if (result != null)
                {
                    foreach (var item in result)
                    {
                        Permohonans.Add(item);
                    }
                }


                var message = await InboxServices.GetItemsAsync(CurrentItem.Id);

                LastMessage = null;
                if (message != null && message.Count() > 0)
                {
                    LastMessage = message.FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                Helper.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }