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));
        }
Beispiel #3
0
        public async Task <ActionResult <FollowModel> > CreateFollow(FollowModel newFollow)
        {
            try
            {
                var follow      = _mapper.Map <FollowModel, Follow>(newFollow);
                var followModel = await _followService.CreateFollow(follow);

                newFollow = _mapper.Map <Follow, FollowModel>(followModel);
                return(Ok(newFollow));
            }
            catch (DBException e)
            {
                return(BadRequest(e.Message));
            }
            catch (Exception e)
            {
                return(BadRequest("Internal error."));
            }
        }