Beispiel #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ClientId,ApplicationId")] Scope scope)
        {
            if (id != scope.ClientId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(scope);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ScopeExists(scope.ClientId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ApplicationId,Name")] Application application)
        {
            if (id != application.ApplicationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(application);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplicationExists(application.ApplicationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(application));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ClientId,Username,Password")] Client client)
        {
            if (id != client.ClientId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ClientId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
Beispiel #4
0
        public IActionResult ChangeStatus(int id, bool status)
        {
            var updateTodo = _identityDBContext.Todo.Find(id);

            if (updateTodo != null)
            {
                //update the Todo item in the database
                updateTodo.Complete = !status;
                //creates a log of changes for this entry. A way to tracking our work
                _identityDBContext.Entry(updateTodo).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _identityDBContext.Update(updateTodo);
                _identityDBContext.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }