Example #1
0
        public static Account GetAccountByAccesData(AccesData accesData)
        {
            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                SqlCommand sqlCommand = new SqlCommand("SELECT acc.Login, acc.Password, acc.Guid, p.ID, p.Name, p.Lastname, p.InviteKey FROM Accounts acc JOIN Persons p on p.ID = acc.Person WHERE acc.Login = @login AND acc.Password = @password", sqlCon);
                sqlCommand.Parameters.AddWithValue("@Login", accesData.Login);
                sqlCommand.Parameters.AddWithValue("@Password", accesData.Password);

                var reader = sqlCommand.ExecuteReader();

                while (reader.Read())
                {
                    return(new Account()
                    {
                        Login = reader[0].ToString(),
                        Password = reader[1].ToString(),
                        Guid = reader[2].ToString(),
                        User = new User()
                        {
                            Id = int.Parse(reader[3].ToString()),
                            Name = reader[4].ToString(),
                            Lastname = reader[5].ToString(),
                            InviteKey = reader[6].ToString()
                        }
                    });
                }
            }
            return(null);
        }
Example #2
0
        public ActionResult About()
        {
            var ListadoPersonas = AccesData.ListadoPersonas();

            ViewBag.Message         = "Your contact page.";
            ViewBag.ListadoPersonas = ListadoPersonas;
            return(View());
        }
Example #3
0
 public static Account GetAccountByAccesData(AccesData accesData) => AccountRepositories.GetAccountByAccesData(accesData);