public async Task <ActionResult <CommonAPIResponse <CountryReturnDTO> > > GetCountryById(int id) { #region Vars CountryReturnDTO CountryReturnDTO = null; #endregion #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <object>(); #endregion try { if (id != default(int)) { CountryReturnDTO = await CountryAppService.GetCountryById(id); } #region Validate userIdentityDTO for nullability before prepaing the response. if (CountryReturnDTO != null) { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), CountryReturnDTO, HttpStatusCode.OK); } else { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), new object(), HttpStatusCode.BadRequest); } #endregion } catch (Exception exception) { } return(jsonResult); }
/// <summary> /// Get Country By Id /// </summary> /// <returns>CountryReturnDTO<CountryReturnDTO></returns> public async Task <CountryReturnDTO> GetCountryById(int CountryId) { #region Declare a return type with initial value. CountryReturnDTO Country = null; #endregion try { if (CountryId > default(int)) { Country = await CountryBusinessMapping.GetCountryById(CountryId); } } catch (Exception exception) {} return(Country); }
public CountryReturnDTO MappingCountryToCountryReturnDTO(Country Country) { #region Declare a return type with initial value. CountryReturnDTO CountryReturnDTO = null; #endregion try { if (Country != null) { CountryReturnDTO = new CountryReturnDTO { CountryId = Country.CountryId, CountryName = Country.CountryName }; } } catch (Exception exception) { } return(CountryReturnDTO); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<CountryReturnDTO></returns> public async Task <CountryReturnDTO> GetCountryById(int CountryId) { #region Declare a return type with initial value. CountryReturnDTO Country = new CountryReturnDTO(); #endregion try { Country country = await UnitOfWork.CountryRepository.GetById(CountryId); if (country != null) { if (country.IsDeleted != (byte)DeleteStatusEnum.Deleted) { Country = CountryMapping.MappingCountryToCountryReturnDTO(country); } } } catch (Exception exception) { } return(Country); }