public async Task <IActionResult> Get(int id) { try { var Userid = UserManagers.GetUserId(User); var user = await User.GetPemohon(Userid); var service = new PermohonanService(new UOWPermohonan()); var result = service.GetPermohonan(id); service.Permohonan = result; result.Tahapans = service.ItemsTahapan(); if (result != null) { result.CurrentTahapan = service.GetCurrentTahapan(); result.NextTahapan = service.GetNextTahapan(); return(Ok(result)); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void GetItemTahapans_When_Permohonan_IsNull_expected_throwExpt_actual_throwExp() { service.SetCurrentPermohonan(null); Assert.Throws <SystemException>(() => service.ItemsTahapan()); }