/// <summary> /// Delete User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> DeletePostJobRole(int PostJobRoleId) { #region Declare a return type with initial value. bool isPostJobRoleDeleted = default(bool); #endregion try { if (PostJobRoleId > default(int)) { #region Vars PostJobRole PostJobRole = null; #endregion #region Get PostJobRole by id PostJobRole = await UnitOfWork.PostJobRoleRepository.GetById(PostJobRoleId); #endregion #region check if object is not null if (PostJobRole != null) { PostJobRole.IsDeleted = (byte)DeleteStatusEnum.Deleted; #region Apply the changes to the database UnitOfWork.PostJobRoleRepository.Update(PostJobRole); isPostJobRoleDeleted = await UnitOfWork.Commit() > default(int); #endregion } #endregion } } catch (Exception exception) { } return(isPostJobRoleDeleted); }
/// <summary> /// Mapping User Activity Log DTO to Action /// </summary> /// <param name=></param> /// <param name=></param> /// <returns></returns> public PostJobRole MappingPostJobRoleupdateDTOToPostJobRole(PostJobRole postJobRole, PostJobRoleUpdateDTO PostJobRoleUpdateDTO) { #region Declare Return Var with Intial Value PostJobRole PostJobRole = postJobRole; #endregion try { if (PostJobRoleUpdateDTO.PostJobRoleId > default(int)) { PostJobRole.JobRoleId = PostJobRoleUpdateDTO.JobRoleId; PostJobRole.PostId = PostJobRoleUpdateDTO.PostId; PostJobRole.PostJobRoleId = PostJobRoleUpdateDTO.PostJobRoleId; } } catch (Exception exception) { } return(PostJobRole); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<PostJobRole></returns> public PostJobRole MappingPostJobRoleAddDTOToPostJobRole(PostJobRoleAddDTO PostJobRoleAddDTO) { #region Declare a return type with initial value. PostJobRole PostJobRole = null; #endregion try { PostJobRole = new PostJobRole { JobRoleId = PostJobRoleAddDTO.JobRoleId, PostId = PostJobRoleAddDTO.PostId, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(PostJobRole); }
public PostJobRoleReturnDTO MappingPostJobRoleToPostJobRoleReturnDTO(PostJobRole PostJobRole) { #region Declare a return type with initial value. PostJobRoleReturnDTO PostJobRoleReturnDTO = null; #endregion try { if (PostJobRole != null) { PostJobRoleReturnDTO = new PostJobRoleReturnDTO { JobRoleId = PostJobRole.JobRoleId, PostId = PostJobRole.PostId, PostJobRoleId = PostJobRole.PostJobRoleId }; } } catch (Exception exception) { } return(PostJobRoleReturnDTO); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<PostJobRoleReturnDTO></returns> public async Task <PostJobRoleReturnDTO> GetPostJobRoleById(int PostJobRoleId) { #region Declare a return type with initial value. PostJobRoleReturnDTO PostJobRole = new PostJobRoleReturnDTO(); #endregion try { PostJobRole postJobRole = await UnitOfWork.PostJobRoleRepository.GetById(PostJobRoleId); if (postJobRole != null) { if (postJobRole.IsDeleted != (byte)DeleteStatusEnum.Deleted) { PostJobRole = PostJobRoleMapping.MappingPostJobRoleToPostJobRoleReturnDTO(postJobRole); } } } catch (Exception exception) { } return(PostJobRole); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddPostJobRole(PostJobRoleAddDTO PostJobRoleAddDTO) { #region Declare a return type with initial value. bool isPostJobRoleCreated = default(bool); #endregion try { #region Vars PostJobRole PostJobRole = null; #endregion PostJobRole = PostJobRoleMapping.MappingPostJobRoleAddDTOToPostJobRole(PostJobRoleAddDTO); if (PostJobRole != null) { await UnitOfWork.PostJobRoleRepository.Insert(PostJobRole); isPostJobRoleCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isPostJobRoleCreated); }
/// <summary> /// Update User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> UpdatePostJobRole(PostJobRoleUpdateDTO PostJobRoleUpdateDTO) { #region Declare a return type with initial value. bool isPostJobRoleUpdated = default(bool); #endregion try { if (PostJobRoleUpdateDTO != null) { #region Vars PostJobRole PostJobRole = null; #endregion #region Get Activity By Id PostJobRole = await UnitOfWork.PostJobRoleRepository.GetById(PostJobRoleUpdateDTO.PostJobRoleId); #endregion if (PostJobRole != null) { #region Mapping PostJobRole = PostJobRoleMapping.MappingPostJobRoleupdateDTOToPostJobRole(PostJobRole, PostJobRoleUpdateDTO); #endregion if (PostJobRole != null) { #region Update Entity UnitOfWork.PostJobRoleRepository.Update(PostJobRole); isPostJobRoleUpdated = await UnitOfWork.Commit() > default(int); #endregion } } } } catch (Exception exception) { } return(isPostJobRoleUpdated); }