Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Location,SSID,Encryption")] Accesspoint accesspoint)
        {
            if (id != accesspoint.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accesspoint);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccesspointExists(accesspoint.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EncryptionType"] = new SelectList(_context.T_APEncryptions, "Encryption", "Encryption", accesspoint.Encryption);
            return(View(accesspoint));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Location,SSID,Encryption")] Accesspoint accesspoint)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accesspoint);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EncryptionType"] = new SelectList(_context.T_APEncryptions, "Encryption", "Encryption", accesspoint.Encryption);
            return(View(accesspoint));
        }