Example #1
0
        public IActionResult Index(BUser buser)
        {
            UserManager um = new UserManager();

            if (um.validate_user(buser))
            {
                string umail = um.getMail(buser.Username);
                buser.Mail = umail;
                MailManager mailManager = new MailManager();

                BMailBot bMailBot = mailManager.getBMailBot();

                /*if(DateTime.Now > um.getLastSent(buser.Username).AddDays(1))
                 * {
                 *  NotificationManager cm = new NotificationManager();
                 *  string message = cm.generateMessage(um.getId(buser.Username));
                 *  mailManager.sendMail(bMailBot.Username, bMailBot.Password, umail, "Report", message);
                 *  um.updateLastSent(um.getId(buser.Username));
                 *
                 * }*/

                //using Observer Design Pattern to notify the user of items that expired.
                ConcreteSubject cs = new ConcreteSubject();
                cs.Attach(buser);
                //cs.Notify();

                BUsername u = new BUsername(buser.Username);
                return(RedirectToAction("Index", "MainPage", u));
            }
            ViewData["message"] = "Invalid Username or Password";
            return(View());
        }
 public IActionResult Index(BUsername bu)
 {
     return(View(bu));
 }