/// <summary> /// Delete User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> DeletePostRelatedIndustry(int PostRelatedIndustryId) { #region Declare a return type with initial value. bool isPostRelatedIndustryDeleted = default(bool); #endregion try { if (PostRelatedIndustryId > default(int)) { #region Vars PostRelatedIndustry PostRelatedIndustry = null; #endregion #region Get PostRelatedIndustry by id PostRelatedIndustry = await UnitOfWork.PostRelatedIndustryRepository.GetById(PostRelatedIndustryId); #endregion #region check if object is not null if (PostRelatedIndustry != null) { PostRelatedIndustry.IsDeleted = (byte)DeleteStatusEnum.Deleted; #region Apply the changes to the database UnitOfWork.PostRelatedIndustryRepository.Update(PostRelatedIndustry); isPostRelatedIndustryDeleted = await UnitOfWork.Commit() > default(int); #endregion } #endregion } } catch (Exception exception) { } return(isPostRelatedIndustryDeleted); }
/// <summary> /// Mapping User Activity Log DTO to Action /// </summary> /// <param name=></param> /// <param name=></param> /// <returns></returns> public PostRelatedIndustry MappingPostRelatedIndustryupdateDTOToPostRelatedIndustry(PostRelatedIndustry postRelatedIndustry, PostRelatedIndustryUpdateDTO PostRelatedIndustryUpdateDTO) { #region Declare Return Var with Intial Value PostRelatedIndustry PostRelatedIndustry = postRelatedIndustry; #endregion try { if (PostRelatedIndustryUpdateDTO.PostRelatedIndustryId > default(int)) { PostRelatedIndustry.IndustryId = PostRelatedIndustryUpdateDTO.IndustryId; PostRelatedIndustry.PostId = PostRelatedIndustryUpdateDTO.PostId; PostRelatedIndustry.PostRelatedIndustryId = PostRelatedIndustryUpdateDTO.PostRelatedIndustryId; } } catch (Exception exception) { } return(PostRelatedIndustry); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<PostRelatedIndustry></returns> public PostRelatedIndustry MappingPostRelatedIndustryAddDTOToPostRelatedIndustry(PostRelatedIndustryAddDTO PostRelatedIndustryAddDTO) { #region Declare a return type with initial value. PostRelatedIndustry PostRelatedIndustry = null; #endregion try { PostRelatedIndustry = new PostRelatedIndustry { IndustryId = PostRelatedIndustryAddDTO.IndustryId, PostId = PostRelatedIndustryAddDTO.PostId, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(PostRelatedIndustry); }
/// <summary> /// Get user Action Activity Log By Id /// </summary> /// <returns>List<PostRelatedIndustryReturnDTO></returns> public async Task <PostRelatedIndustryReturnDTO> GetPostRelatedIndustryById(int PostRelatedIndustryId) { #region Declare a return type with initial value. PostRelatedIndustryReturnDTO PostRelatedIndustry = new PostRelatedIndustryReturnDTO(); #endregion try { PostRelatedIndustry postRelatedIndustry = await UnitOfWork.PostRelatedIndustryRepository.GetById(PostRelatedIndustryId); if (postRelatedIndustry != null) { if (postRelatedIndustry.IsDeleted != (byte)DeleteStatusEnum.Deleted) { PostRelatedIndustry = PostRelatedIndustryMapping.MappingPostRelatedIndustryToPostRelatedIndustryReturnDTO(postRelatedIndustry); } } } catch (Exception exception) { } return(PostRelatedIndustry); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddPostRelatedIndustry(PostRelatedIndustryAddDTO PostRelatedIndustryAddDTO) { #region Declare a return type with initial value. bool isPostRelatedIndustryCreated = default(bool); #endregion try { #region Vars PostRelatedIndustry PostRelatedIndustry = null; #endregion PostRelatedIndustry = PostRelatedIndustryMapping.MappingPostRelatedIndustryAddDTOToPostRelatedIndustry(PostRelatedIndustryAddDTO); if (PostRelatedIndustry != null) { await UnitOfWork.PostRelatedIndustryRepository.Insert(PostRelatedIndustry); isPostRelatedIndustryCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isPostRelatedIndustryCreated); }
/// <summary> /// Update User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> UpdatePostRelatedIndustry(PostRelatedIndustryUpdateDTO PostRelatedIndustryUpdateDTO) { #region Declare a return type with initial value. bool isPostRelatedIndustryUpdated = default(bool); #endregion try { if (PostRelatedIndustryUpdateDTO != null) { #region Vars PostRelatedIndustry PostRelatedIndustry = null; #endregion #region Get Activity By Id PostRelatedIndustry = await UnitOfWork.PostRelatedIndustryRepository.GetById(PostRelatedIndustryUpdateDTO.PostRelatedIndustryId); #endregion if (PostRelatedIndustry != null) { #region Mapping PostRelatedIndustry = PostRelatedIndustryMapping.MappingPostRelatedIndustryupdateDTOToPostRelatedIndustry(PostRelatedIndustry, PostRelatedIndustryUpdateDTO); #endregion if (PostRelatedIndustry != null) { #region Update Entity UnitOfWork.PostRelatedIndustryRepository.Update(PostRelatedIndustry); isPostRelatedIndustryUpdated = await UnitOfWork.Commit() > default(int); #endregion } } } } catch (Exception exception) { } return(isPostRelatedIndustryUpdated); }
public PostRelatedIndustryReturnDTO MappingPostRelatedIndustryToPostRelatedIndustryReturnDTO(PostRelatedIndustry PostRelatedIndustry) { #region Declare a return type with initial value. PostRelatedIndustryReturnDTO PostRelatedIndustryReturnDTO = null; #endregion try { if (PostRelatedIndustry != null) { PostRelatedIndustryReturnDTO = new PostRelatedIndustryReturnDTO { IndustryId = PostRelatedIndustry.IndustryId, PostId = PostRelatedIndustry.PostId, PostRelatedIndustryId = PostRelatedIndustry.PostRelatedIndustryId }; } } catch (Exception exception) { } return(PostRelatedIndustryReturnDTO); }