Beispiel #1
0
        public async Task <IActionResult> Create([Bind("ApplicationId,Name")] Application application)
        {
            if (ModelState.IsValid)
            {
                application.ApplicationId = Guid.NewGuid();
                _context.Add(application);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(application));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ClientId,Username,Password")] Client client)
        {
            if (ModelState.IsValid)
            {
                client.ClientId = Guid.NewGuid();
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("ClientId,ApplicationId")] Scope scope)
        {
            if (ModelState.IsValid)
            {
                _context.Add(scope);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationId"] = new SelectList(_context.Applications, "ApplicationId", "ApplicationId", scope.ApplicationId);
            ViewData["ClientId"]      = new SelectList(_context.Clients, "ClientId", "ClientId", scope.ClientId);
            return(View(scope));
        }