Beispiel #1
0
 // GET BY ID
 public static Personnels GetById(int id)
 {
     using (var context = new TacheContext())
     {
         return(context.Set <Personnels>().Find(id));
     }
 }
Beispiel #2
0
 public static Users Find(int id)
 {
     using (var context = new TacheContext())
     {
         return(context.Set <Users>().Find(id));
     }
 }
Beispiel #3
0
 public static bool verfify(Users user)
 {
     using (var context = new TacheContext())
     {
         var _user = context.Set <Users>().Where(u => u.username == user.username);
         if (user != null)
         {
             return(false);
         }
         return(true);
     }
 }
Beispiel #4
0
 public static Users IsUser(Users user)
 {
     using (var context = new TacheContext())
     {
         try
         {
             return(context.Set <Users>().Where(s => s.username == user.username && s.password == user.password).FirstOrDefault());
         }
         catch (Exception e)
         {
             return(null);
         }
     }
 }
Beispiel #5
0
        public static List <Personnels> GetByPage(int page)
        {
            if (page == 0)
            {
                page = 1;
            }
            int count = 5;
            var skip  = (count * page) - count;

            if (GetAll().Count() < skip)
            {
                skip = 0;
            }

            using (var context = new TacheContext())
            {
                return(context.Set <Personnels>().Skip(skip).Take(count).ToList());
            }
        }