예제 #1
0
        public async Task <ActionResult <UserBadgeResource> > AddBadgeToUser(Guid userId, [FromBody] BadgeResource badgeToAddResource)
        {
            var badgeToAdd = _mapper.Map <BadgeResource, Badge>(badgeToAddResource);

            try
            {
                var badgeAddedToUser = _badgeService.AddBadgeToUser(userId, badgeToAdd);
                return(Ok(badgeAddedToUser));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }