public async Task <User> CheckUser(string email, string password)
        {
            if (email != null && password != null)
            {
                SqlAccount sqlAccount = await dbContext.SqlAccounts.Where(x => x.Email.Equals(email)).FirstOrDefaultAsync(x => x.Password.Equals(password));

                SqlAssignement sqlAssignement = await dbContext.SqlAssignements.FirstOrDefaultAsync(x => x.SqlAccount.Id == sqlAccount.Id);

                SqlUser sqlUser = sqlAssignement.SqlUser;
                return(mapper.Map <User>(sqlUser));
            }
            throw new NullReferenceException();
        }
        public async Task <bool> ResetAssignementAsync(Assignement assignement)
        {
            if (int.TryParse(assignement.Id, out int assignementId))
            {
                SqlAssignement sqlAssignement = await dbContext.SqlAssignements.FirstOrDefaultAsync(x => x.Id == assignementId);

                sqlAssignement.DeactivationDate = null;
                await dbContext.SaveChangesAsync();

                return(true);
            }
            return(false);
        }
        } // return a user from it's id

        public async Task <bool> DeleteAssignement(string id)
        {
            ObjectEmpty(id);
            if (int.TryParse(id, out int assignementId))
            {
                SqlAssignement sqlAssignement = await dbContext.SqlAssignements.FirstOrDefaultAsync(x => x.Id == assignementId);

                ObjectEmptyFromDb(sqlAssignement);
                sqlAssignement.DeactivationDate = DateTime.UtcNow;
                sqlAssignement.LastEdit         = DateTime.UtcNow;
                await dbContext.SaveChangesAsync();

                return(true);
            }
            throw new NullReferenceException(Resource.InvalidOperation);
        } // set deactivation date of a relation from it's id
        public async Task <bool> DeleteAssignement(SqlAccount sqlAccount, SqlUser sqlUser)
        {
            if (sqlAccount == null || sqlUser == null)
            {
                throw new NullReferenceException(Resource.ObjectEmpty);
            }
            SqlAssignement sqlAssignement = dbContext.SqlAssignements.Where(x => x.SqlAccount.Id == sqlAccount.Id)
                                            .Where(x => x.SqlUser.Id == sqlUser.Id)
                                            .Where(x => x.DeactivationDate == null)
                                            .FirstOrDefault();

            sqlAssignement.DeactivationDate = DateTime.UtcNow;
            sqlAssignement.LastEdit         = DateTime.UtcNow;
            await dbContext.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> SetAssignemet(SqlUser sqlUser, SqlAccount sqlAccount)
        {
            if (sqlUser == null || sqlAccount == null)
            {
                throw new NullReferenceException(Resource.ObjectEmpty);
            }
            SqlAssignement sqlAssignement = new SqlAssignement
            {
                SqlUser      = sqlUser,
                SqlAccount   = sqlAccount,
                CreationDate = DateTime.UtcNow,
                LastEdit     = DateTime.UtcNow
            };

            dbContext.SqlAssignements.Add(sqlAssignement);
            await dbContext.SaveChangesAsync();

            return(true);
        }