// GET: Business/NotificationSettings public ActionResult Index() { var model = new NotificationsettingModel(); var user = new RepositoryUserProfile().GetUserbyId(CurrentUserId); model.Name = user.FirstName + " " + user.LastName; model.Notifications = from p in db.LookupNotificationTypes join ap in db.UserNotificationMappers.Where(e => e.UserId == CurrentUserId) on p.Id equals ap.NotificationTypeId into joined from j in joined.DefaultIfEmpty() select new NotificationModel { NotificationTypeId = p.Id, NotificationType = p.Title, Status = j.Status == null ? true : j.Status }; return(View(model)); }
// GET: NotificationSettings public ActionResult Index() { var currentUserId = User.Identity.GetUserId <int>(); var model = new NotificationsettingModel(); var user = new RepositoryUserProfile().GetUserbyId(currentUserId); ViewBag.businessName = user.BusinessName; ViewBag.RelativeUrl = user.RelativeUrl; ViewBag.Logo = "/Assets/" + user.BusinessId + "/Logo_" + user.BusinessId + ".jpg"; model.Name = user.FirstName + " " + user.LastName; model.Notifications = from p in db.LookupNotificationTypes join ap in db.UserNotificationMappers.Where(e => e.UserId == currentUserId) on p.Id equals ap.NotificationTypeId into joined from j in joined.DefaultIfEmpty() select new NotificationModel { NotificationTypeId = p.Id, NotificationType = p.Title, Status = j.Status == null ? true : j.Status }; return(View(model)); }