public async Task <ActionResult <CommonAPIResponse <bool> > > AddPost(PostAddDTO PostAddDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate AddPost for nullability before prepaing the response. if (await PostAppService.AddPost(PostAddDTO)) { 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); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<Post></returns> public Post MappingPostAddDTOToPost(PostAddDTO PostAddDTO) { #region Declare a return type with initial value. Post Post = null; #endregion try { Post = new Post { YearsOfExperience = PostAddDTO.YearsOfExperience, AddationalSalary = PostAddDTO.AddationalSalary, Area = PostAddDTO.Area, CareerLevelId = PostAddDTO.CareerLevelId, IsClosed = PostAddDTO.IsClosed, IsHideSalary = PostAddDTO.IsHideSalary, NumberOfVacancies = PostAddDTO.NumberOfVacancies, PostDescription = PostAddDTO.PostDescription, PostLocationId = PostAddDTO.PostLocationId, PostTypeId = PostAddDTO.PostTypeId, SalaryFrom = PostAddDTO.SalaryFrom, SalaryTo = PostAddDTO.SalaryTo, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(Post); }
/// <summary> /// Add Post AppService /// </summary> /// <returns>bool<bool></returns> public async Task <bool> AddPost(PostAddDTO postAddDTO) { #region Declare a return type with initial value. bool isCreated = false; #endregion try { if (postAddDTO != null) { isCreated = await PostBusinessMapping.AddPost(postAddDTO); } } catch (Exception exception) {} return(isCreated); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddPost(PostAddDTO PostAddDTO) { #region Declare a return type with initial value. bool isPostCreated = default(bool); #endregion try { #region Vars Post Post = null; #endregion Post = PostMapping.MappingPostAddDTOToPost(PostAddDTO); if (Post != null) { await UnitOfWork.PostRepository.Insert(Post); isPostCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isPostCreated); }