public OperationResultListVo <NotificationItemViewModel> GetByUserId(Guid userId, int count) { List <Notification> notifications = notificationDomainService.GetByUserId(userId).OrderByDescending(x => x.CreateDate).Take(count).ToList(); var vms = mapper.Map <IEnumerable <NotificationItemViewModel> >(notifications); return(new OperationResultListVo <NotificationItemViewModel>(vms)); }
public OperationResultListVo <NotificationItemViewModel> GetByUserId(Guid userId, int count) { List <Notification> notifications = notificationDomainService.GetByUserId(userId).OrderByDescending(x => x.CreateDate).Take(count).ToList(); List <NotificationItemViewModel> tempList = new List <NotificationItemViewModel>(); foreach (Notification notification in notifications) { NotificationItemViewModel vm = new NotificationItemViewModel { Id = notification.Id, UserId = notification.UserId, Text = notification.Text, Url = notification.Url, IsRead = notification.IsRead, CreateDate = notification.CreateDate, Type = notification.Type }; tempList.Add(vm); } return(new OperationResultListVo <NotificationItemViewModel>(tempList)); }