public async Task InsertStudent()
        {
            //In order to create or insert new date we first instantiate a new type. We then update the values of the properties. Next we add it to the underlying set of the context and then save that back to the database.


            using (var context = new collegestudentsEntities())
            {
                var contact = new Student_Details();
                contact.Name       = Name;
                contact.Address    = Address;
                contact.Phone      = Phone;
                contact.CourseIDFK = CourseIDFK;
                //Add to entity set of context
                context.Student_Details.Add(contact);


                // add new marks to cascade up the student details.

                var marks = new Mark();
                marks.Marks1   = 0;
                marks.marks2   = 0;
                marks.Marks3   = 0;
                marks.Marks4   = 0;
                marks.StudIDFK = contact.StudID;
                context.Marks.Add(marks);

                await context.SaveChangesAsync();

                //      ClearTextBoxes();
            }
        }
        public async Task UpdateStudent()
        {
            using (var context = new collegestudentsEntities())
            {
                var query   = from s in context.Student_Details where s.StudID == StudID select s;
                var student = query.FirstOrDefault(); //gets the first one although we know there is only one
                student.Name       = Name;
                student.Address    = Address;
                student.Phone      = Phone;
                student.CourseIDFK = CourseIDFK;

                await context.SaveChangesAsync();
            }
        }
        public async Task Delete()
        {
            //Our standard Using statement passing all the data to context

            using (var context = new collegestudentsEntities())
            {
                //select the row you want to delete

                var contact = (from s in context.Student_Details where s.StudID == StudID select s).SingleOrDefault();

                //run remove command
                context.Student_Details.Remove(contact);
                //save the changes
                await context.SaveChangesAsync();

                //ClearTextBoxes();
            }
        }