Beispiel #1
0
 public static List <Personnels> GetAll()
 {
     using (var context = new TacheContext())
     {
         return(context.Personnel.ToList());
     }
 }
Beispiel #2
0
 public static Users Find(int id)
 {
     using (var context = new TacheContext())
     {
         return(context.Set <Users>().Find(id));
     }
 }
Beispiel #3
0
 // GET BY ID
 public static Personnels GetById(int id)
 {
     using (var context = new TacheContext())
     {
         return(context.Set <Personnels>().Find(id));
     }
 }
Beispiel #4
0
 public static List <Taches> GetAll()
 {
     using (var context = new TacheContext())
     {
         return(context.Tache.ToList());
     }
 }
Beispiel #5
0
 // CREATE PERSONNEL
 public static void create(Personnels Personnel)
 {
     using (var context = new TacheContext())
     {
         context.Personnel.Add(Personnel);
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public static void addPersonnelToTask(Taches taches, Personnels personnels)
 {
     using (var context = new TacheContext())
     {
         context.Tache.Update(taches);
         context.SaveChanges();
     }
 }
Beispiel #7
0
 public static Boolean Create(Taches taches)
 {
     using (var context = new TacheContext())
     {
         context.Tache.Add(taches);
         context.SaveChanges();
         return(true);
     }
     return(false);
 }
Beispiel #8
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 #9
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 #10
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());
            }
        }
Beispiel #11
0
        public static List <dynamic> GetTask(int idTache = 0, int page = 0)
        {
            int count = 5;

            if (page == 0)
            {
                page = 1;
            }
            if (page > GetAll().Count + count)
            {
                page = 1;
            }
            int skip = (page * count) - count;

            using (var context = new TacheContext())
            {
                return(context.Tache
                       .Where(e => (e.IdTache == idTache) || idTache == 0)
                       .Select(tache => new
                {
                    idTache = tache.IdTache,
                    TacheName = tache.TacheName,
                    Description = tache.Description,
                    TimeStart = tache.TimeStart,
                    Deadline = tache.Deadline,
                    Completed = tache.Completed,
                    Personnel = tache.personnels
                                .Select(personnel => new
                    {
                        idPersonnel = personnel.IdPersonnel,
                        Name = personnel.Name,
                        Email = personnel.Email,
                        filename = personnel.ImagePersonnel
                    }).ToList()
                })
                       .Skip(skip)
                       .OrderByDescending(t => t.TimeStart)
                       .Take(count)
                       .ToList <dynamic>());
            }
        }
 public PersonnelController(IWebHostEnvironment webHostEnvironment, TacheContext context)
 {
     this._context       = context;
     _webHostEnvironment = webHostEnvironment;
 }
 public DepartementController(TacheContext context)
 {
     this.context = context;
 }
 public TacheController(TacheContext context)
 {
     this.context = context;
 }
Beispiel #15
0
 public TachesController(TacheContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public AuthentificationController(IConfiguration config, TacheContext context)
 {
     this._conf   = config;
     this.context = context;
 }