public static tblClinicAdministrator AddAdministrator(tblClinicAdministrator admin)
        {
            try
            {
                using (MedicalInstitutionEntities4 context = new MedicalInstitutionEntities4())
                {
                    if (admin.adminId == 0)
                    {
                        //add
                        tblClinicAdministrator newAdmin = new tblClinicAdministrator();
                        //newAdmin.instituteId = editClinic.instituteId;
                        newAdmin.userId = admin.userId;
                        context.tblClinicAdministrators.Add(newAdmin);
                        context.SaveChanges();
                        admin.adminId = newAdmin.adminId;
                        return(admin);
                    }
                    else
                    {
                        tblClinicAdministrator adminToEdit = (from x in context.tblClinicAdministrators where x.adminId == admin.adminId select x).FirstOrDefault();
                        adminToEdit.userId      = admin.userId;
                        adminToEdit.instituteId = admin.instituteId;

                        context.SaveChanges();
                        return(admin);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message.ToString());
                return(null);
            }
        }
 //null or return administrator
 public static tblClinicAdministrator isAdministrator(tblUser e)
 {
     try
     {
         using (MedicalInstitutionEntities4 context = new MedicalInstitutionEntities4())
         {
             tblClinicAdministrator result = (from x in context.tblClinicAdministrators where x.userId == e.userId select x).FirstOrDefault();
             return(result);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception " + ex.Message.ToString());
         return(null);
     }
 }