Exemplo n.º 1
0
        public async Task <ActionResult> UpdatePost([FromRoute] int id, [FromBody] RecruitmentPostToUpdateParam param)
        {
            int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            if (await _recruitmentService.UpdateRecruitmentPost(param))
            {
                await _fcmService.SendMessage(userId, "Updating post succeed", "Recruitment post id " + param.PostId + " updated.");

                return(NoContent());
            }
            else
            {
                await _fcmService.SendMessage(userId, "Updating post failed", "Updating recruitment post id " + param.PostId + " failed.");
            }
            return(BadRequest());
        }
Exemplo n.º 2
0
        public async Task <bool> UpdateRecruitmentPost(RecruitmentPostToUpdateParam param)
        {
            RecruitmentPost post = await _uow.RecruitmentRepository.GetFirst(filter : post => post.PostId == param.PostId);

            post.Title          = param.Title;
            post.MinSalary      = param.MinSalary;
            post.MajorId        = param.MajorId;
            post.MaxSalary      = param.MaxSalary;
            post.Location       = param.Location;
            post.JobRequirement = param.JobRequirement;
            post.JobDescription = param.JobDescription;
            post.JobBenefit     = param.JobBenefit;
            post.ExpectedNumber = param.ExpectedNumber;
            post.DueDate        = param.DueDate;
            _uow.RecruitmentRepository.Update(post);
            if (await _uow.CommitAsync() > 0)
            {
                return(true);
            }
            return(false);
        }