public async Task <IActionResult> OnGetAsync() { var user = await _userManager.GetUserAsync(User); var notificationList = _context.NoNotifications.Where(x => x.UserId == user.Id); var mailNotify = new MailNotify() { BeforeLecture = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.LectureStart), CourseUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.CourseUpdate), ImportantUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.ImportantUpdate), OfferAndOther = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.Email).Any(x => x.NotificationType == EnumList.Notifications.OfferAndOther), }; //ToDo :: Add Sms notify list var smsNotify = new SmsNotify() { BeforeLecture = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.LectureStart), CourseUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.CourseUpdate), ImportantUpdate = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.ImportantUpdate), OfferAndOther = !notificationList.Where(x => x.Method == EnumList.NotifyMethod.SMS).Any(x => x.NotificationType == EnumList.Notifications.OfferAndOther), }; Input = new InputModel() { ShowName = user.ShowFullName, FullName = user.FirstName + " " + user.LastName, ProfileUserName = user.ProfileUserName, MailNotify = mailNotify, SmsNotify = smsNotify }; return(Page()); }
private static void Main(string[] args) { Console.WriteLine("Observer Mode Demo"); var creditCard = new CreditCard(); var sms = new SmsNotify(); var account = new Account(1000); creditCard.SpendMoney += account.Update; creditCard.SpendMoney += sms.Update; creditCard.SpendAmount = 200; }