public PiuneDetails Get(int Id)
        {
            SqlConnection con   = new SqlConnection("Data Source=DESKTOP-3LQJUUD;Initial Catalog=SchoolDB;User ID=sa;Password=123");
            string        query = "Select * from dbo.PiuneDetails Where Id = @Id";
            SqlCommand    cmd   = new SqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", Id);
            con.Open();
            PiuneDetails  piuneDetails = null;
            SqlDataReader dr           = cmd.ExecuteReader();

            if (dr.Read())
            {
                piuneDetails = new PiuneDetails
                {
                    Id              = (int)dr[0],
                    PiuneName       = dr[1].ToString(),
                    SchoolId        = (int)dr[2],
                    Address         = dr[3].ToString(),
                    Salary          = (int)dr[4],
                    DepartmentId    = (int)dr[5],
                    Age             = (int)dr[6],
                    Gender          = dr[7].ToString(),
                    City            = dr[8].ToString(),
                    State           = dr[9].ToString(),
                    Country         = dr[10].ToString(),
                    IsActive        = (bool)dr[11],
                    CreatedDateTime = (DateTime)dr[12],
                    ContactId       = (int)dr[13],
                    CreatedBy       = (int)dr[14],
                };
                con.Close();
            }
            return(piuneDetails);
        }
        public bool Post(PiuneDetails piuneDetails)
        {
            SqlConnection con   = new SqlConnection("Data Source=DESKTOP-3LQJUUD;Initial Catalog=SchoolDB;User ID=sa;Password=123");
            string        query = "Insert into dbo.PiuneDetails (PiuneName,SchoolId,Address,Salary,DepartmentId,Age,Gender,City,State,Country,IsActive,CreatedDateTime,ContactId,CreatedBy) Values(@PiuneName,@SchoolId,@Address,@Salary,@DepartmentId,@Age,@Gender,@City,@State,@Country,@IsActive,@CreatedDateTime,@ContactId,@CreatedBy)";
            SqlCommand    cmd   = new SqlCommand(query, con);

            cmd.Parameters.AddWithValue("@PiuneName", piuneDetails.PiuneName);
            cmd.Parameters.AddWithValue("@SchoolId", piuneDetails.SchoolId);
            cmd.Parameters.AddWithValue("@Address", piuneDetails.Address);
            cmd.Parameters.AddWithValue("@Salary", piuneDetails.Salary);
            cmd.Parameters.AddWithValue("@DepartmentId", piuneDetails.DepartmentId);
            cmd.Parameters.AddWithValue("@Age", piuneDetails.Age);
            cmd.Parameters.AddWithValue("@Gender", piuneDetails.Gender);
            cmd.Parameters.AddWithValue("@City", piuneDetails.City);
            cmd.Parameters.AddWithValue("@State", piuneDetails.State);
            cmd.Parameters.AddWithValue("@Country", piuneDetails.Country);
            cmd.Parameters.AddWithValue("@IsActive", piuneDetails.IsActive);
            cmd.Parameters.AddWithValue("@CreatedDateTime", piuneDetails.CreatedDateTime);
            cmd.Parameters.AddWithValue("@ContactId", piuneDetails.ContactId);
            cmd.Parameters.AddWithValue("@CreatedBy", piuneDetails.CreatedBy);
            con.Open();
            int noOfRowAffected = cmd.ExecuteNonQuery();

            con.Close();
            if (noOfRowAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public List <PiuneDetails> GetAll()
        {
            SqlConnection con   = new SqlConnection("Data Source=DESKTOP-3LQJUUD;Initial Catalog=SchoolDB;User ID=sa;Password=123");
            string        query = "Select * from dbo.PiuneDetails";
            SqlCommand    cmd   = new SqlCommand(query, con);

            con.Open();
            List <PiuneDetails> piuneDetails = new List <PiuneDetails>();
            SqlDataReader       dr           = cmd.ExecuteReader();

            while (dr.Read())
            {
                PiuneDetails piune = new PiuneDetails()
                {
                    Id              = (int)dr[0],
                    PiuneName       = dr[1].ToString(),
                    SchoolId        = (int)dr[2],
                    Address         = dr[3].ToString(),
                    Salary          = (int)dr[4],
                    DepartmentId    = (int)dr[5],
                    Age             = (int)dr[6],
                    Gender          = dr[7].ToString(),
                    City            = dr[8].ToString(),
                    State           = dr[9].ToString(),
                    Country         = dr[10].ToString(),
                    IsActive        = (bool)dr[11],
                    CreatedDateTime = (DateTime)dr[12],
                    ContactId       = (int)dr[13],
                    CreatedBy       = (int)dr[14],
                };
                piuneDetails.Add(piune);
            }
            con.Close();
            return(piuneDetails);
        }