Beispiel #1
0
        public void GetUserApplicationEmptyIdentifier()
        {
            var core = new ApplicationCore();

            core.Get(new Application());
        }
Beispiel #2
0
        public void GetApplicationInformationNullUser()
        {
            var core = new ApplicationCore();

            core.Get(null, Guid.NewGuid());
        }
Beispiel #3
0
        public void GetUserApplicationNull()
        {
            var core = new ApplicationCore();

            core.Get((Application)null);
        }
Beispiel #4
0
        public void GetApplicationInformationNull()
        {
            var core = new ApplicationCore();

            core.Get((ApplicationInformation)null);
        }
Beispiel #5
0
 public RoutesDefaultsWithLanguage(ApplicationCore core) : base(core)
 {
     Language = core.Get <Core.Languages.Manager>().GetUserLanguage().ShortName;
 }
        public ActionResult  Details(Guid appId)
        {
            using (new PerformanceMonitor())
            {
                var app = new Application()
                {
                    Identifier = appId,
                };

                try
                {
                    var canCreateApplication = this.CanCreateAnApplication();
                    if (canCreateApplication && Guid.Empty == appId)
                    {
                        var newApp = new ApplicationDetailsModel()
                        {
                            ApplicationId = Guid.NewGuid(),
                            IsValid       = true,
                            New           = true,
                            Deleted       = false,
                            Active        = true,
                            ValidUntil    = DateTime.UtcNow.AddYears(1),
                        };

                        newApp.PublicKey    = newApp.ApplicationId.ToAscii85().GetHexMD5();
                        this.ViewData.Model = newApp;
                    }
                    else if (Guid.Empty != appId && appCore.UserIsAssociated(User.Identity.Editor(), app))
                    {
                        var info = new ApplicationInformation()
                        {
                            Identifier = appId,
                        };
                        var appInfo = appCore.Get(info);
                        if (null != appInfo)
                        {
                            var model = appInfo.Convert();

                            try
                            {
                                if (Guid.Empty != appInfo.OwnerId)
                                {
                                    var userCore    = new UserCore();
                                    var application = new Application()
                                    {
                                        Identifier = appId,
                                    };
                                    var user = new User()
                                    {
                                        Identifier = appInfo.OwnerId,
                                    };
                                    var userApp = new UserApplication()
                                    {
                                        Application = application,
                                        User        = user,
                                    };
                                    var userLoaded = userCore.Get(userApp);
                                    model.User = userLoaded.Convert().Convert();
                                }
                            }
                            catch (Exception ex)
                            {
                                log.Log(ex, EventTypes.Error, (int)Fault.Unknown);
                            }

                            this.ViewData.Model = model;
                        }
                    }
                    else
                    {
                        return(this.RedirectToAction("Application"));
                    }

                    ViewBag.CanCreateAnApplication = canCreateApplication;
                    return(this.View());
                }
                catch (Exception ex)
                {
                    log.Log(ex, EventTypes.Error, (int)Fault.Unknown);
                    return(View());
                }
            }
        }
        /// <summary>
        /// Get Applications
        /// </summary>
        /// <returns>Application Details Models</returns>
        private IEnumerable <ApplicationDetailsModel> GetApplications()
        {
            var applications = appCore.Get(User.Identity.Data(), ServerConfiguration.ApplicationIdentifier);

            return(applications.Convert(User.Identity.Data()));
        }