Exemple #1
0
        public ActionResult Authenticate(string Email, string Password)
        {
            var AuthResult = AuthService.AuthUser(Email, Password, GlobalParams.ProjectType);

            if (AuthResult.IsSuccess)
            {
                Session[GlobalParams.UserSessionKey] = AuthResult;
                return(RedirectToAction("Index", "Material"));
            }
            else
            {
                InternalNotification.Subscribe(new AlertMessage()
                {
                    Message     = "Email or Password incorrect",
                    MessageType = InternalNotificationType.error
                });
                return(View("index"));
            }
        }
Exemple #2
0
        public ActionResult CreateUser(string cpf)
        {
            if (string.IsNullOrEmpty(cpf))
            {
                InternalNotification.Subscribe(new AlertMessage()
                {
                    Message     = "CPF is requered",
                    MessageType = InternalNotificationType.error
                });
                return(View("index"));
            }

            if (UserService.Exists(cpf))
            {
                InternalNotification.Subscribe(new AlertMessage()
                {
                    Message     = "There is already a user for this cpf",
                    MessageType = InternalNotificationType.error
                });
                return(View("index"));
            }
            return(RedirectToAction("Insert", "Users"));
        }