Пример #1
0
        public UserOutput InsertUser(UserInput userInput)
        {
            var user = _mapper.Map <User>(userInput);

            user = _users.Insert(user);
            _uow.Save();

            return(_mapper.Map <UserOutput>(user));
        }
Пример #2
0
        public void Validate(string token, int id, bool authenticate)
        {
            var controlToken = GetValidToken(id);

            if (controlToken is null || controlToken.Token != token)
            {
                throw new ApiException(HttpStatusCode.Forbidden, "Invalid Token");
            }

            if (authenticate)
            {
                controlToken.AuthenticationDate = DateTime.Now;
                _uow.Save();
            }
        }