Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
        /// <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);
        }