public async Task <ActionResult <CommonAPIResponse <CityReturnDTO> > > GetCityById(int id)
        {
            #region Vars
            CityReturnDTO CityReturnDTO = null;
            #endregion
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <object>();
            #endregion
            try
            {
                if (id != default(int))
                {
                    CityReturnDTO = await CityAppService.GetCityById(id);
                }

                #region Validate userIdentityDTO for nullability before prepaing the response.
                if (CityReturnDTO != null)
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), CityReturnDTO, HttpStatusCode.OK);
                }
                else
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), new object(), HttpStatusCode.BadRequest);
                }
                #endregion
            }
            catch (Exception exception)
            {
            }
            return(jsonResult);
        }
예제 #2
0
 /// <summary>
 /// Get  City By Id
 /// </summary>
 /// <returns>CityReturnDTO<CityReturnDTO></returns>
 public async Task <CityReturnDTO> GetCityById(int CityId)
 {
     #region Declare a return type with initial value.
     CityReturnDTO City = null;
     #endregion
     try
     {
         if (CityId > default(int))
         {
             City = await CityBusinessMapping.GetCityById(CityId);
         }
     }
     catch (Exception exception)  {}
     return(City);
 }
 public CityReturnDTO MappingCityToCityReturnDTO(City City)
 {
     #region Declare a return type with initial value.
     CityReturnDTO CityReturnDTO = null;
     #endregion
     try
     {
         if (City != null)
         {
             CityReturnDTO = new CityReturnDTO
             {
                 CityId   = City.CityId,
                 CountyId = (int)City.CountyId,
                 CityName = City.CityName
             };
         }
     }
     catch (Exception exception)
     { }
     return(CityReturnDTO);
 }
예제 #4
0
        /// <summary>
        /// Get user Action Activity Log By Id
        /// </summary>
        /// <returns>List<CityReturnDTO></returns>
        public async Task <CityReturnDTO> GetCityById(int CityId)
        {
            #region Declare a return type with initial value.
            CityReturnDTO City = new CityReturnDTO();
            #endregion
            try
            {
                City city = await UnitOfWork.CityRepository.GetById(CityId);

                if (city != null)
                {
                    if (city.IsDeleted != (byte)DeleteStatusEnum.Deleted)
                    {
                        City = CityMapping.MappingCityToCityReturnDTO(city);
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(City);
        }