Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Key,EventType,Rtc,HistoryDataType,HistoryBytes")] History history)
        {
            if (id != history.Key)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(history);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HistoryExists(history.Key))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(history));
        }
Example #2
0
        public async Task <IActionResult> Edit(string id, [Bind("SerialNumber,SerialNumberFull,Name,LinkMac,PumpMac,RadioChannel,LinkKey")] Device device)
        {
            if (id != device.SerialNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(device);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeviceExists(device.SerialNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(device));
        }
        public async Task <IActionResult> Edit(string id, [Bind("ConfigurationName,ConfigurationValue")] Configuration configuration)
        {
            if (id != configuration.ConfigurationName)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(configuration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConfigurationExists(configuration.ConfigurationName))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(configuration));
        }