public async Task <ActionResult> Create(CreateReplyRequestModel model) { var userId = this.User.GetId(); var replyId = await this.repliesService .CreateAsync(model.Content, model.AdvertisementId, model.RootCommentId, userId); return(Created(nameof(this.Create), replyId)); }
public async Task <IActionResult> Post(int restaurantId, int reviewId, [FromBody] CreateReplyRequestModel model) { var reply = CreateReply(User.GetUserId(), model, reviewId, null); reply = await this.replyRepository.CreateAsync(reply); var response = Mapper.Map <ReplyResponseModel>(reply); return(Created("", response)); }
private Reply CreateReply(string userId, CreateReplyRequestModel model, int reviewId, int?replyId) { return(new Reply { Id = replyId ?? 0, ReviewId = reviewId, UserId = userId, Text = model.Text, TimeStamp = DateTime.Now }); }