Пример #1
0
        public async Task <dynamic> CreateOrUpdateCommentAsync(CreateOrUpdateCommentDto input)
        {
            try
            {
                var comments = await _commentRepo.GetAllListAsync();

                var comment = comments.FirstOrDefault(cmt => cmt.IsRecruiterWrite == input.IsRecruiterWrite && cmt.IDJobSeeker == input.IDJobSeeker && cmt.IDRecruiter == input.IDRecruiter);

                if (comment == null)
                {
                    await _commentRepo.InsertAsync(ObjectMapper.Map <Comment>(input));
                }
                else
                {
                    ObjectMapper.Map(input, comment);
                    await _commentRepo.UpdateAsync(comment);
                }
            }
            catch (Exception)
            {
            }
            finally{
            }
            return(await  GetCommentsAsync(input.IsRecruiterWrite, input.IsRecruiterWrite?input.IDJobSeeker : input.IDRecruiter));
        }
Пример #2
0
        public async Task <dynamic> CreateOrUpdate(CreateOrUpdateCommentDto input)
        {
            // Tạo comment trả về comment
            //var newComment = await _commentServiceAppService.CreateCommentAsync(input);
            //return CreatedAtAction("Gets", new { id = newComment.Id }, newComment)


            // Tạo comment trả về một danh sách các comment
            return(await _commentServiceAppService.CreateOrUpdateCommentAsync(input));

            //return CreatedAtAction("Gets", new { id = newComment.Id }, (await _commentServiceAppService.GetCommentsAsync(input.IsRecruiterWrite, newComment)));
        }
Пример #3
0
        public async Task DeleteCommentAsync(DeleteCommentDto input)
        {
            // this.AbpSession.UserId;
            var commentUpdateOrDeleteDto = new CreateOrUpdateCommentDto()
            {
                IDJobSeeker      = input.IDJobSeeker,
                IDRecruiter      = input.IDRecruiter,
                IsRecruiterWrite = input.isRecruiterWrite,
                Reason           = "",
                Description      = "",
                StarNumber       = null
            };

            await CreateOrUpdateCommentAsync(commentUpdateOrDeleteDto);
        }