Exemplo n.º 1
0
        public IActionResult SignUp(User user)
        {
            var repository = new UrlRepository(_conn);

            repository.AddUser(user);
            return(Redirect("/account/login"));
        }
Exemplo n.º 2
0
        public ActionResult Register(User user, string password)
        {
            var manager = new UrlRepository(Properties.Settings.Default.ConStr);

            manager.AddUser(user, password);
            return(Redirect("LogIn"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the user.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">
        /// Id value is invalid
        /// or
        /// UserName value is invalid
        /// </exception>
        public Url AddUser(string id, string userName)
        {
            if (!id.IsShortCode())
            {
                throw new ArgumentException("Id value is invalid");
            }

            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("UserName value is invalid");
            }

            try
            {
                List <string> users = new List <string>();
                users.Add(userName);
                return(_repository.AddUser(id, users));
            }
            catch (Exception ex)
            {
                throw HandleException(new object[] { id, userName }, ex);
            }
        }