public async Task <ActionResult <FollowResponse> > Create(CreateFollowRequest model) { model.FollowerId = Account.Id; model.Status = Entities.Status.Created; var follow = await _followService.CreateFollow(model); return(Ok(follow)); }
public async Task <IActionResult> Create([FromBody] CreateFollowRequest createFollowRequest) { if (ModelState.IsValid) { var response = await _followService.CreateFollow(new Guid(createFollowRequest.ProfileId), new Guid(createFollowRequest.FollowId)); return(response.Success ? new OkObjectResult(response) : StatusCode(500)); } return(StatusCode(400)); }
//Create public async Task <FollowResponse> CreateFollow(CreateFollowRequest model) { var follow = _mapper.Map <Follow>(model); if (follow == null) { throw new AppException("Create follow failed"); } await _context.Follows.AddAsync(follow); await _context.SaveChangesAsync(); await SendNotification(follow); return(_mapper.Map <FollowResponse>(follow)); }