public static tblStaff AddStaff(tblStaff staff)
 {
     try
     {
         using (dbHotelEntities context = new dbHotelEntities())
         {
             if (staff.staffId == 0)
             {
                 //add
                 tblStaff newStaff = new tblStaff();
                 newStaff.userId       = staff.userId;
                 newStaff.citizenship  = staff.citizenship;
                 newStaff.floorNumber  = staff.floorNumber;
                 newStaff.engegamentId = staff.engegamentId;
                 newStaff.genderId     = staff.genderId;
                 context.tblStaffs.Add(newStaff);
                 context.SaveChanges();
                 staff.staffId = newStaff.staffId;
                 return(staff);
             }
             else
             {
                 tblStaff staffToEdit = (from x in context.tblStaffs where x.staffId == staff.staffId select x).FirstOrDefault();
                 staffToEdit.salary = staff.salary;
                 context.SaveChanges();
                 return(staff);
             }
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message.ToString());
         return(null);
     }
 }
 public static tblStaff getStaff(int userId)
 {
     try
     {
         using (dbHotelEntities context = new dbHotelEntities())
         {
             tblStaff res = (from x in context.tblStaffs where x.userId == userId select x).FirstOrDefault();
             return(res);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception " + ex.Message.ToString());
         return(null);
     }
 }
        public static string GetRole(int id)
        {
            try
            {
                using (dbHotelEntities context = new dbHotelEntities())
                {
                    tblStaff res = (from x in context.tblStaffs where x.userId == id select x).FirstOrDefault();

                    if (res != null)
                    {
                        return("staff");
                    }
                    else
                    {
                        return("manager");
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception " + ex.Message.ToString());
                return(null);
            }
        }