Ejemplo n.º 1
0
    ///<summary>
    ///Creating stud in Database
    ///</summary>
    ///<param name = "studName">Student's username</param>
    public async Task PostingStud(string studName)
    {
        (currentCourse.students).Add(studName);
        DatabaseQAHandler.PutCourse(courseName, currentCourse, () => { });
        Stopwatch sw    = Stopwatch.StartNew();
        var       delay = Task.Delay(1000).ContinueWith(_ =>
        {
            sw.Stop();
            return(sw.ElapsedMilliseconds);
        });
        await delay;
        int   sec = (int)delay.Result;

        Debug.Log("Enroll Student Elapsed milliseconds: {0}" + sec);
    }
Ejemplo n.º 2
0
    ///<summary>
    ///Deleting stud in Database
    ///</summary>
    public async void DeleteStud()
    {
        loader.SetActive(true);
        (currentCourse.students).RemoveAt(delName);
        DatabaseQAHandler.PutCourse(courseName, currentCourse, () => { });
        Stopwatch sw    = Stopwatch.StartNew();
        var       delay = Task.Delay(1000).ContinueWith(_ =>
        {
            sw.Stop();
            return(sw.ElapsedMilliseconds);
        });
        await delay;
        int   sec = (int)delay.Result;

        Debug.Log("Delete Stud Elapsed milliseconds: {0}" + sec);
        await Read();

        loader.SetActive(false);
        messageBox.SetActive(true);
        messageBox.transform.GetChild(1).GetComponent <Text>().text = "Unenroll successfully.";
    }