public async Task <ActionResult <CommonAPIResponse <PostTypeReturnDTO> > > GetPostTypeById(int id) { #region Vars PostTypeReturnDTO PostTypeReturnDTO = null; #endregion #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <object>(); #endregion try { if (id != default(int)) { PostTypeReturnDTO = await PostTypeAppService.GetPostTypeById(id); } #region Validate userIdentityDTO for nullability before prepaing the response. if (PostTypeReturnDTO != null) { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), PostTypeReturnDTO, HttpStatusCode.OK); } else { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), new object(), HttpStatusCode.BadRequest); } #endregion } catch (Exception exception) { } return(jsonResult); }
/// <summary> /// Get PostType By Id /// </summary> /// <returns>PostTypeReturnDTO<PostTypeReturnDTO></returns> public async Task <PostTypeReturnDTO> GetPostTypeById(int PostTypeId) { #region Declare a return type with initial value. PostTypeReturnDTO PostType = null; #endregion try { if (PostTypeId > default(int)) { PostType = await PostTypeBusinessMapping.GetPostTypeById(PostTypeId); } } catch (Exception exception) {} return(PostType); }
public PostTypeReturnDTO MappingPostTypeToPostTypeReturnDTO(PostType PostType) { #region Declare a return type with initial value. PostTypeReturnDTO PostTypeReturnDTO = null; #endregion try { if (PostType != null) { PostTypeReturnDTO = new PostTypeReturnDTO { PostTypeId = PostType.PostTypeId, PostTypeName = PostType.PostTypeName }; } } catch (Exception exception) { } return(PostTypeReturnDTO); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<PostTypeReturnDTO></returns> public async Task <PostTypeReturnDTO> GetPostTypeById(int PostTypeId) { #region Declare a return type with initial value. PostTypeReturnDTO PostType = new PostTypeReturnDTO(); #endregion try { PostType postType = await UnitOfWork.PostTypeRepository.GetById(PostTypeId); if (postType != null) { if (postType.IsDeleted != (byte)DeleteStatusEnum.Deleted) { PostType = PostTypeMapping.MappingPostTypeToPostTypeReturnDTO(postType); } } } catch (Exception exception) { } return(PostType); }