Ejemplo n.º 1
0
        public IHttpActionResult Put([FromBody] UserConfirmation userConfirmation)
        {
            try
            {
                // check if confirmation code matches
                var userRepository = new UserRepository();
                var userGuid       = userRepository.GetUserGuid(userConfirmation.ConfirmationEmail);

                // if userGuid matches
                if (userGuid == userConfirmation.ConfirmationCode)
                {
                    userRepository.ActivateUser(userConfirmation.ConfirmationEmail);
                }
                else
                {
                    return(NotFound());
                }

                return(Ok(userConfirmation));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Ejemplo n.º 2
0
 public ActionResult <User> ActivateUser(string userId)
 {
     IUserRepository repository = new UserRepository();
     {
         repository.ActivateUser(userId);
         return(Ok());
     }
 }
Ejemplo n.º 3
0
        public ActionResult UserActivate(Guid id)
        {
            RepositoryLayerResult <Users> user = ur.ActivateUser(id);

            if (user.Errors.Count > 0)
            {
                ErrorViewModel erModel = new ErrorViewModel()
                {
                    Title = "Account not valid.",
                    Items = user.Errors
                };
                return(View("Error", erModel));
            }

            OkViewModel okModel = new OkViewModel()
            {
                Title         = "Account Activation Successful",
                RedirectinUrl = "/Home/Login"
            };

            return(View("Ok", okModel));
        }
Ejemplo n.º 4
0
        public int ActivateUser(string userName)
        {
            int rowsAffected = 0;

            using (var _dalSession = new DalSession())
            {
                UnitOfWork _uow = _dalSession.UnitOfWork;
                _uow.Begin();
                try
                {
                    var userRepository = new UserRepository(_uow);
                    rowsAffected = userRepository.ActivateUser(userName);
                    _uow.Commit();
                }
                catch
                {
                    _uow.Rollback();
                    throw;
                }
            }

            return(rowsAffected);
        }