Exemple #1
0
        //Update
        public async Task <FollowResponse> UpdateFollow(int id, UpdateFollowRequest model)
        {
            var follow = await getFollow(id);

            if (follow == null)
            {
                throw new AppException("Update follow failed");
            }
            _mapper.Map(model, follow);
            _context.Follows.Update(follow);
            await _context.SaveChangesAsync();

            return(_mapper.Map <FollowResponse>(follow));;
        }
        public async Task <ActionResult <FollowResponse> > Update(int id, UpdateFollowRequest model)
        {
            var follow = await _followService.UpdateFollow(id, model);

            return(Ok(follow));
        }