Esempio n. 1
0
        public bool SetUserInfo(int id, string username, string password)
        {
            Connection c = new Connection();

            Utilizadores = new UtilizadorDAO(c);
            // Encontra o utilizador através do seu username
            Utilizador updated = Utilizadores.FindById(id);

            if (username != null)
            {
                if (Utilizadores.FindByUsername(username) == true)
                {
                    throw new InvalidOperationException("There already exists a user with the same username!");
                }
                else
                {
                    updated.Username = username;
                }
            }
            if (password != null)
            {
                updated.Password = password;
            }

            return(Utilizadores.Update(updated));
        }
Esempio n. 2
0
        // 3. ************* EDIT User DETAILS ******************
        // GET: User/Edit/5
        public ActionResult Edit(int id)
        {
            IConnection connection = new Connection();

            connection.Fetch();
            IDAO <Utilizador> uDAO = new UtilizadorDAO(connection);

            return(View(uDAO.FindById(1)));
        }