コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ConfigId,Brand,Model,Storage,Cpu,CpuType,CpuSpeed,RAM,HasGPU,HeadphoneOutput,Capable5g,FrontCameraMegapixel,BackCameraMegapixel,BatteryCapacity,ExchangableBattery,Depth,Height,Width,Weight,WirelessCharging,WirelessStandard,DualSim,SimCard,FastCharging,WaterResistance,ReleaseYear")] PhoneProperties phoneProperties)
        {
            if (id != phoneProperties.ConfigId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phoneProperties);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhonePropertiesExists(phoneProperties.ConfigId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(phoneProperties));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ConfigId,Brand,Model,Storage,HasMemoryCardReader,Cpu,CpuCoreCount,CpuSpeed,RAM,HasGPU,GPU,HeadphoneOutput,Is2gCapable,Is3gCapable,Is4gCapable,Is5gCapable,HasBluetooth,HasGPS,IsWifiCapable,BuiltInCamera,FrontCamera,FrontCameraMegapixel,BackCameraMegapixel,MaximumLensApeture,RearCameraCount,CanRecordVideo,MaxFramerateMaxResolution,MaxFramerateMinResolution,BatteryCapacity,ExchangableBattery,Depth,Height,Width,Weight,WirelessCharging,WirelessStandard,DualSim,SimCard,FastCharging,WaterResistance,OriginalPrice,ReleaseDate,ProductPage,isSelected")] PhoneProperties phoneProperties)
        {
            if (id != phoneProperties.ConfigId)
            {
                return(NotFound());
            }

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