示例#1
0
        public async Task <IActionResult> VisitUser(VisitUserDto visitUserDto)
        {
            if (visitUserDto.VisitorId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            return(Ok(await _usersService.VisitUser(visitUserDto)));
        }
示例#2
0
        public async Task <KeyValuePair <bool, string> > VisitUser(VisitUserDto visitUserDto)
        {
            // Map visit user dto to visit object
            var visit = _mapper.Map <Visit>(visitUserDto);

            _unitOfWork.Users.VisitUser(visit);

            if (await _unitOfWork.Complete())
            {
                return(new KeyValuePair <bool, string>(true, "User successfully visited!"));
            }

            return(new KeyValuePair <bool, string>(false, "Problem with visiting user!"));
        }