public ActionResult Index(int page = 1) { string userId = this.User.Identity.GetUserId(); var viewModel = new NotificationPageViewModel(); var notification = this.tripNotificationServices.GetForUser(userId); int allNotificationCount = notification.Count(); int totalPages = (int)Math.Ceiling(allNotificationCount / (double)DefaultItemsPerPage); int notificationsToSkip = (page - 1) * DefaultItemsPerPage; viewModel.Notifications = notification .To<NotificationTripViewModel>() .Skip(notificationsToSkip) .Take(DefaultItemsPerPage) .ToList(); foreach (var notif in viewModel.Notifications) { if (notif.Seen == false) { this.tripNotificationServices.SetAsSeen(notif.Id); } notif.ActionModel = this.notificationProvider.GetAvailableActionModel(notif.Type.Key, notif.ActionHasBeenTaken, notif.Trip.Id, notif.FromUserId); } var user = this.userSerives.GetById(userId); viewModel.User = this.Mapper.Map<BaseUserViewModel>(user); viewModel.CurrentPage = page; viewModel.TotalPages = totalPages; return this.View("~/Areas/UserProfile/Views/Notification/Index.cshtml", viewModel); }
public NotificationsPage() { InitializeComponent(); if (!UserLogged.IsLogged) { ToolbarItems.Clear(); return; } this.BindingContext = viewModel = new NotificationPageViewModel(); Init(); }
public NotificationPage(string type) { try { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); notificationPageVM = new NotificationPageViewModel(Navigation, type); BindingContext = notificationPageVM; } catch (Exception ex) { UserDialogs.Instance.HideLoading(); } }
protected override void OnAppearing() { AppChat.Helpers.Helper.Instiance().TurnOffGesture(); base.OnAppearing(); if (Device.RuntimePlatform == Device.iOS) { fiend.Icon = "ReqAdd"; challegen.Icon = "pingpong"; community.Icon = "club"; } if (model == null) { model = this.BindingContext as NotificationPageViewModel; } }
public NotificationPage() { InitializeComponent(); this.ViewModel = new NotificationPageViewModel() { Title = this.Title }; this.BindingContext = this.ViewModel; if (this.ViewModel.NotificationList?.Count == 0) { this.NullNotificationLayout.IsVisible = true; this.NotificationListView.IsVisible = false; } else { this.NullNotificationLayout.IsVisible = false; this.NotificationListView.IsVisible = true; } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); this.DataContext = _viewModel = new NotificationPageViewModel(); }