public IActionResult Get(int id) { try { var model = facade.ReadById(id); //model.Password = ""; var viewModel = mapper.Map <ExpeditionViewModel>(model); if (viewModel == null) { throw new Exception("Invalid Id"); } Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.OK_STATUS_CODE, General.OK_MESSAGE) .Ok(viewModel); return(Ok(Result)); } catch (Exception e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result)); } }
public async Task Should_Success_Get_Data_By_Id() { ExpeditionFacade facade = new ExpeditionFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod())); var model = await dataUtil(facade, GetCurrentMethod()).GetTestData(); var Response = facade.ReadById((int)model.Id); Assert.NotNull(Response); }