public IActionResult GetAll() { var invitations = _invitiationRepository.GetAll(); var claimsIdentity = this.User.Identity as ClaimsIdentity; var user = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; bool succes = Int32.TryParse(user, out var userId); if (succes) { var loggedUser = _userService.GetById(userId); if (loggedUser != null) { return(Ok(invitations.Where(h => h.ReceiverEmail == loggedUser.Email))); } } return(Ok()); }
private IEnumerable <InvitationViewModel> Load() { return(_mapper.Map <IEnumerable <InvitationViewModel> >(_invitationRepository.GetAll(User.Identity.Name))); }