Пример #1
0
        public IActionResult ShowKeys(string newAppId, string expireKey)
        {
            string sessionId = this.cookie.Get("TelemetrySession");

            if (string.IsNullOrEmpty(sessionId))
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                GetUserByCookieResponse reportUserByCookie = this.authenticationService.GetUserByWebCookie(sessionId);
                if (reportUserByCookie.Success == true)
                {
                    if (reportUserByCookie.User.IsOrganizationAdmin)
                    {
                        if (!(string.IsNullOrEmpty(expireKey)))
                        {
                            this.customTelemetryService.ExpireTelemetryKey(Guid.Parse(expireKey));
                        }
                        if (!(string.IsNullOrEmpty(newAppId)))
                        {
                            this.customTelemetryService.AddTelemetryKey(newAppId, reportUserByCookie.User.Username);
                        }
                    }
                    var viewModel = new ShowKeysViewModel(telemetryRetrievalService);
                    return(View(viewModel));
                }
                else
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:M138ADemo.ShowKeys"/> class.
        /// </summary>
        public ShowKeys()
        {
            InitializeComponent();

            viewModel  = new ShowKeysViewModel();
            interactor = new ShowAndAddKeysInteractor(dataGrid, viewModel);

            viewModel.NotifyOnClose += () => this.Close();
            mAddKeyButton.Command    = viewModel.AddkeyCommand;

            mEndButton.Command = viewModel.EndCommand;
        }