public IHttpActionResult GetAllForUser() { var identity = (ClaimsIdentity)User.Identity; IEnumerable <Claim> claims = identity.Claims; var userId = int.Parse(claims.Where(c => c.Type == ClaimTypes.NameIdentifier).FirstOrDefault().Value); IEnumerable <Notification> list = userNotificationService.GetAllNotificationsForUser(userId, NotificationType.ALL); List <NotificationViewModel> retList = new List <NotificationViewModel>(); foreach (var obj in list) { retList.Add( new NotificationViewModel() { DateTime = obj.DateTime, Message = obj.Message, CommentId = obj.CommentId, SurveyId = obj.SurveyId, NotificationType = obj.NotificaionType, Id = obj.Id, Operation = obj.Operation, UserId = obj.UserId, GroupId = obj.GroupId } ); } return(Ok(retList)); }