Exemplo n.º 1
0
 /// <summary>
 /// Updae PostType AppService
 /// </summary>
 /// <returns>bool<bool></returns>
 public async Task <bool> UpdatePostType(PostTypeUpdateDTO postTypeUpdateDTO)
 {
     #region Declare a return type with initial value.
     bool isUpdated = false;
     #endregion
     try
     {
         if (postTypeUpdateDTO != null)
         {
             isUpdated = await PostTypeBusinessMapping.UpdatePostType(postTypeUpdateDTO);
         }
     }
     catch (Exception exception) {}
     return(isUpdated);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public PostType MappingPostTypeupdateDTOToPostType(PostType postType, PostTypeUpdateDTO PostTypeUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     PostType PostType = postType;
     #endregion
     try
     {
         if (PostTypeUpdateDTO.PostTypeId > default(int))
         {
             PostType.PostTypeId   = PostTypeUpdateDTO.PostTypeId;
             PostType.PostTypeName = PostTypeUpdateDTO.PostTypeName;
         }
     }
     catch (Exception exception) { }
     return(PostType);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Update User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> UpdatePostType(PostTypeUpdateDTO PostTypeUpdateDTO)
        {
            #region Declare a return type with initial value.
            bool isPostTypeUpdated = default(bool);
            #endregion
            try
            {
                if (PostTypeUpdateDTO != null)
                {
                    #region Vars
                    PostType PostType = null;
                    #endregion
                    #region Get Activity By Id
                    PostType = await UnitOfWork.PostTypeRepository.GetById(PostTypeUpdateDTO.PostTypeId);

                    #endregion
                    if (PostType != null)
                    {
                        #region  Mapping
                        PostType = PostTypeMapping.MappingPostTypeupdateDTOToPostType(PostType, PostTypeUpdateDTO);
                        #endregion
                        if (PostType != null)
                        {
                            #region  Update Entity
                            UnitOfWork.PostTypeRepository.Update(PostType);
                            isPostTypeUpdated = await UnitOfWork.Commit() > default(int);

                            #endregion
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(isPostTypeUpdated);
        }
Exemplo n.º 4
0
        public async Task <ActionResult <CommonAPIResponse <bool> > > UpdatePostType(PostTypeUpdateDTO PostTypeUpdateDTO)
        {
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <bool>();
            #endregion

            try
            {
                #region Validate userUpdateDTO for nullability before prepaing the response.
                if (await PostTypeAppService.UpdatePostType(PostTypeUpdateDTO))
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), true, HttpStatusCode.OK);
                }
                else
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), false, HttpStatusCode.BadRequest);
                }
                #endregion
            }
            catch (Exception exception)
            {
            }
            return(jsonResult);
        }