Beispiel #1
0
        public ActionResult RegisterStorage(CloudStorageServices service)
        {
            string redirectUrl = "";
            string targetUrl   = "";

            switch (service)
            {
            case CloudStorageServices.Dropbox:
                int credentialId = -1;
                targetUrl   = this.Url.Action("RegisterDropboxStorage", "Account", null, this.Request.Url.Scheme);
                redirectUrl = this.serviceDropbox.AskForRegistrationUrl(this.CurrentUser, targetUrl, out credentialId);
                TempData["tempCredentialId"] = credentialId;
                break;

            case CloudStorageServices.GoogleDrive:
                return(this.RedirectToComingSoon());

                break;

            case CloudStorageServices.Skydrive:
                return(this.RedirectToComingSoon());

                targetUrl   = this.Url.Action("RegisterSkydriveStorage", "Account", null, this.Request.Url.Scheme);
                redirectUrl = this.serviceSkydrive.AskForRegistrationUrl(this.CurrentUser, targetUrl, out credentialId);
                break;
            }
            return(Redirect(redirectUrl));
        }
Beispiel #2
0
        public UserStorageVM GetUserStorages(UserProfileInfo userProfile)
        {
            UserStorageVM         model       = new UserStorageVM();
            List <AuthCredential> credentials = this.repoAuthCredential
                                                .GetByUserId(userProfile.Id)
                                                .Where(c => c.Status != CredentialStatus.Canceled)
                                                .ToList();
            var values = from MoG.Domain.Models.CloudStorageServices e in Enum.GetValues(typeof(MoG.Domain.Models.CloudStorageServices))
                         select new { Id = e, Name = e.ToString() };

            foreach (var cloudStorage in Enum.GetValues(typeof(MoG.Domain.Models.CloudStorageServices)))
            {
                CloudStorageServices currentCloudStorage = (CloudStorageServices)cloudStorage;
                var userCredentials = credentials.Where(c => c.CloudService == currentCloudStorage).ToList();
                if (userCredentials.Count > 0)
                {
                    model.CloudStorages.AddRange(userCredentials);
                }
                else
                {
                    model.CloudStorages.Add(new AuthCredential()
                    {
                        CloudService = currentCloudStorage,
                        Status       = CredentialStatus.NotRegistered
                    });
                }
            }


            return(model);
        }
Beispiel #3
0
        public ActionResult RegisterStorage(CloudStorageServices service)
        {
            string redirectUrl = "";
            string targetUrl = "";
            switch (service)
            {
                case CloudStorageServices.Dropbox:
                    int credentialId = -1;
                    targetUrl = this.Url.Action("RegisterDropboxStorage", "Account", null, this.Request.Url.Scheme);
                    redirectUrl = this.serviceDropbox.AskForRegistrationUrl(this.CurrentUser, targetUrl, out credentialId);
                    TempData["tempCredentialId"] = credentialId;
                    break;
                case CloudStorageServices.GoogleDrive:
                    return this.RedirectToComingSoon();
                    break;
                case CloudStorageServices.Skydrive:
                    return this.RedirectToComingSoon();
                    targetUrl = this.Url.Action("RegisterSkydriveStorage", "Account", null, this.Request.Url.Scheme);
                    redirectUrl = this.serviceSkydrive.AskForRegistrationUrl(this.CurrentUser, targetUrl, out credentialId);
                    break;

            }
            return Redirect(redirectUrl);
        }