using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Configuration;

namespace AspNetFrameworkMVC.Models
{
	public class LoginManager
	{
		public static bool CheckLogin(string username, string password)
		{
			string connString = WebConfigurationManager.ConnectionStrings["Default"].ConnectionString;
			using (SqlConnection conn = new SqlConnection(connString))
			{
				conn.Open();
				string qry = "SELECT * FROM Login WHERE Username = @user AND Password = @password";
				SqlCommand cmd = new SqlCommand(qry, conn);
				cmd.Parameters.AddWithValue("@user", username);
				cmd.Parameters.AddWithValue("@password", password);
				object res = cmd.ExecuteScalar();

				return res != null;
			}

		}
	}
}