How to rotate a gameobject (Y Axis) via c#?

So I want a system like the ones that are in many racing games, where when you press middle mouse (and while it is held down), the camera shows whats behind you (rotates 180 on the Y axis). My game is a being chased FPS, so I want to be able to look behind me, while keep running forward, this is possible, I’ve tried it by rotating the object the camera is on in the inspector and it works, so all I have to do is roate that object. In my script I have a gameobject called “you”. That is the object with the camera on it, all I need to do is figure out a way to rotate it 180 on the Y, and then on unclick make it go backto 0. Here is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookBehind : MonoBehaviour
{

    public GameObject m9;
    public bool On;
    public bool onoff;
    public GameObject curs;
    public GameObject you;
  
    public void Update()
    {
        if (Input.GetMouseButton(2))
        {
            onoff = !onoff;

            if (onoff)
            {
                m9.SetActive(false);
                curs.SetActive(false);

           
            }
        }

        else
        {
            m9.SetActive(true);
            curs.SetActive(true);


        }
    }
}

Add this function in your class :

 public void ObjectRotation(GameObject _you){
    _you.transform.roation = Quaternion.Euler(new Vector3([Degree in X axis],[Degree in Y axis],[Degree in Z axis]));
    }

Call it where you want Game Object to rotate (replace to your rotation angle in degree).
ie:

ObjectRotation(you);

you.LocalEulerAngles = new Vector3(x,y,z,);