Beispiel #1
0
        //public ActionResult Stop()
        //{
        //    string username = Convert.ToString(Session["username"]);
        //    UserProfile user = _gService.GetUserVMDetail(username);
        //    _azService.Deallocate(Constant.Constant.resourceGroupName, user.machines[0]);
        //    var retVal = _azService.GetVMStatus(Constant.Constant.resourceGroupName, user.machines[0]);
        //    return Json(retVal, JsonRequestBehavior.AllowGet);
        //}

        public ActionResult Success()
        {
            GoogleService google   = new GoogleService();
            string        code     = Convert.ToString(Request.QueryString["code"]);
            string        token    = google.GetToken(code);
            UserProfile   userinfo = google.userProfile(token);

            Session["username"] = userinfo.email;
            if (string.IsNullOrEmpty(userinfo.email))
            {
                return(Content("Email not found"));
            }
            else
            {
                if (Constant.Constant.IsProduction)
                {
                    if (userinfo.email.Contains("@organizedgains.com"))
                    {
                        return(RedirectToAction("index"));
                    }
                    else
                    {
                        return(Redirect(GoogleContants.ExternalRedirection));
                    }
                }
                else
                {
                    return(RedirectToAction("index"));
                }
            }
        }
        public TokenModel GetToken(AuthorizationModel model)
        {
            var json = _service.GetToken(model).Result;

            return(JsonConvert.DeserializeObject <TokenModel>(json));
        }