public IHttpActionResult GetAllMarks() { string role = ((ClaimsPrincipal)RequestContext.Principal).FindFirst(x => x.Type == ClaimTypes.Role).Value; string userId = ((ClaimsPrincipal)RequestContext.Principal).FindFirst(x => x.Type == "UserId").Value; IEnumerable <MarkDTOOut> marks = marksService.GetAllMarks(role, userId); return(Ok(marks)); }
public async Task <ActionResult> GetAllMarks() { var result = await marksService.GetAllMarks(); if (result == null) { return(NotFound()); } return(Ok(result)); }
public IHttpActionResult GetAllMarks(Guid teacher_id) { IEnumerable <MarkDto> marks; try { marks = db.GetAllMarks(teacher_id); } catch (NullReferenceException e) { logger.Error(e.Message); return(NotFound()); } return(Ok(marks.Select(x => { x.AccessType = EAccessType.Teacher; return x; }))); }