/// <summary> /// Retourne la note correspondant à l'identifiant /// </summary> /// <param name="id">Identifiant de la note</param> /// <returns>Entité <see cref="Note"/></returns> public Note GetNoteById(int id) { NoteQuery query = new NoteQuery(monContexte); Note result = query.GetById(id); return(result); }
/// <summary> /// Retourne les notes correspondant à un élève /// </summary> /// <param name="eleveId">Identifiant de l'élève</param> /// <returns>Liste d'entités <see cref="Note"/></returns> public List <Note> GetNotesByEleveId(int eleveId) { NoteQuery query = new NoteQuery(monContexte); List <Note> result = query.GetByEleveId(eleveId); return(result); }
/// <summary> /// Retourne toutes les notes /// </summary> /// <returns>Liste d'entités <see cref="Note"/></returns> public List <Note> GetAllNotes() { NoteQuery query = new NoteQuery(monContexte); List <Note> result = query.GetAll(); return(result); }
public async Task <List <NoteModel> > Get(NoteQuery filter) { if (!filter.IdObserver.HasValue) { filter.IdObserver = this.GetIdObserver(); } return(await _mediator.Send(filter)); }
/// <summary> /// Permet d'obtenir la moyenne de l'élève /// </summary> /// <param name="eleveId">Identifiant de l'élève</param> /// <returns></returns> public double GetAverageByEleveId(int eleveId) { NoteQuery query = new NoteQuery(monContexte); List <Note> result = query.GetByEleveId(eleveId); if (result.Count() == 0) { return(0); } return(result.Average(n => n.ValeurNote)); }
/// <summary> /// Récupérer la moyenne des notes en base par l'ID de l'élève /// </summary> /// <param name="eleveID">Identifiant de l'élève</param> /// <returns>string</returns> public string GetAvgByEleveId(int eleveID) { NoteQuery nq = new NoteQuery(contexte); List <Note> notes = nq.GetByEleveID(eleveID).ToList(); if (notes.Count == 0) { return("Aucunes notes."); } double moy = notes.Average(note => note.Valeur); return(moy.ToString()); }
public async Task <List <NoteModel> > Get(NoteQuery filter) { if (!this.IsTokenValid(_tokenService.GetTemporaryToken(this.GetCurrentUserId()))) { throw new UnauthorizedAccessException(); } if (!filter.UserId.HasValue || filter.UserId <= 0) { filter.UserId = this.GetCurrentUserId(); } return(await _mediator.Send(filter)); }
public async Task <List <NoteModel> > Handle(NoteQuery message, CancellationToken token) { return(await _context.Notes .Where(n => n.IdObserver == message.IdObserver && n.IdPollingStation == message.IdPollingStation) .OrderBy(n => n.LastModified) .Select(n => new NoteModel { AttachmentPath = n.AttachementPath, Text = n.Text, FormCode = n.Question.FormSection.Form.Code, FormId = n.Question.FormSection.Form.Id, QuestionId = n.Question.Id }) .ToListAsync(cancellationToken: token)); }
public Eleve GetOneEleve(int id) { EleveQuery eq = new EleveQuery(context); Eleve e = eq.GetOne(id); NoteQuery nq = new NoteQuery(context); e.Notes = nq.GetByEleveId(id).ToList(); AbsenceQuery aq = new AbsenceQuery(context); e.Absences = aq.GetByEleveId(id).ToList(); return(e); }
public List <Eleve> GetAllEleve() { EleveQuery eq = new EleveQuery(context); List <Eleve> eleves = new List <Eleve>(); foreach (Eleve e in eq.GetAll().ToList()) { NoteQuery nq = new NoteQuery(context); e.Notes = nq.GetByEleveId(e.Id).ToList(); AbsenceQuery aq = new AbsenceQuery(context); e.Absences = aq.GetByEleveId(e.Id).ToList(); eleves.Add(e); } return(eleves); }
public async Task <NoteCollection> List(NoteQuery query) { var dbQuery = await query.Create(this.Entities); var total = await dbQuery.CountAsync(); if (total == 0) { await this.Add(new NoteInput() { Text = "First Note\n\nThis is the first note." }); total = await dbQuery.CountAsync(); } dbQuery = dbQuery.Skip(query.SkipTo(total)).Take(query.Limit); var results = await mapper.MapNote(dbQuery).ToListAsync(); return(new NoteCollection(query, total, results)); }
public async Task <List <NoteModel> > Handle(NoteQuery message, CancellationToken token) { // check if beneficiary exists and that the current user is allowed to view the beneficiary notes var currentUser = await _context.Users.FirstOrDefaultAsync(u => u.UserId == message.UserId); var beneficiary = _context.Beneficiaries.Include(b => b.User).FirstOrDefault(b => b.BeneficiaryId == message.BeneficiaryId); if (beneficiary == null || (currentUser.NgoId != beneficiary.User.NgoId)) { throw new UnauthorizedAccessException(); } if (message.FormId > 0) { return(await _context.Notes .Where(n => n.UserId == message.UserId && n.BeneficiaryId == message.BeneficiaryId && n.Question.FormSection.Form.FormId == message.FormId) .OrderBy(n => n.LastModified) .Select(n => new NoteModel { AttachmentPath = n.AttachementPath, Text = n.Text, QuestionId = n.QuestionId, LastModified = n.LastModified }) .ToListAsync(cancellationToken: token)); } else { return(await _context.Notes .Where(n => n.UserId == message.UserId && n.BeneficiaryId == message.BeneficiaryId && n.QuestionId == null) .OrderBy(n => n.LastModified) .Select(n => new NoteModel { AttachmentPath = n.AttachementPath, Text = n.Text, LastModified = n.LastModified }) .ToListAsync(cancellationToken: token)); } }
public List <Note> GetNotesByEleve(int EleveID) { NoteQuery query = new NoteQuery(_contexte); return(query.GetNotesByEleve(EleveID)); }
public Note DeleteNote(int noteId) { NoteQuery query = new NoteQuery(_contexte); return(query.DeleteNote(noteId)); }
public int AddNote(Note n) { NoteQuery query = new NoteQuery(_contexte); return(query.AddNote(n)); }
/// <summary> /// Récupérer les notes en base par l'ID de l'élève /// </summary> /// <returns>List<Notes></Notes></returns> public List <Note> GetNotesByEleveId(int eleveID) { NoteQuery nq = new NoteQuery(contexte); return(nq.GetByEleveID(eleveID).ToList()); }
/// <summary> /// Récupérer une note en base par son ID /// </summary> /// <returns>Note</returns> public Note GetNoteById(int noteID) { NoteQuery nq = new NoteQuery(contexte); return(nq.GetByID(noteID).SingleOrDefault()); }
/// <summary> /// Récupérer une liste de note en base /// </summary> /// <returns>Liste de Note</returns> public List <Note> GetAllNote() { NoteQuery nq = new NoteQuery(contexte); return(nq.GetAll().ToList()); }
public List <Note> GetNotesByEleve(int idEleve) { NoteQuery nq = new NoteQuery(contexte); return(nq.GetNotesByEleve(idEleve).ToList()); }
public List <Note> GetNotesByEleve(int eleveId) { NoteQuery query = new NoteQuery(_monContexte); return(query.GetAll().ToList()); }
public async Task <NoteCollection> List([FromQuery] NoteQuery query) { return(await repo.List(query)); }
public Note GetNoteById(int idNote) { NoteQuery nq = new NoteQuery(contexte); return(nq.GetNoteById(idNote)); }