示例#1
0
        public ActionResult Connexion(string compte, string mot_de_passe)
        {
            try
            {
                // -- Réccupération du l'utilisateur authentifié -- //
                Utilisateur utilisateur = UtilisateurDAO.Authentification(compte, mot_de_passe);

                // -- Authentifier l'objet connexion -- //
                this.con.Authentification(utilisateur);

                // -- Notification -- //
                this.ViewBag.notification = new GBNotification(
                    new {
                    url = Url.Action("Main", "Application")
                }
                    );
            }
            #region Catch
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(true);
                }
                else
                {
                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(ex.Message, true);
                }
            }
            #endregion

            // -- Retoure le résultat en objet JSON -- //
            return(Json(
                       GBConvert.To_Object(this.ViewBag)
                       ));
        }