예제 #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Platform,CPU,Voltage,FlashMemory,RAM,GPIOCount,AnalogPinCount,PWMPinCount,USBConnectorCount,PowerJack,USBPower,ResetButton,Wifi,Bluetooth,BLE,Out5V,Out3_3V,MaxSourceAmps,Description,Features,Manufacturer,Model,SerialNumber,Source,UnitPrice,Tax,Shipping,DateOfAcquisition,Height,Width,Depth,Weight,ID,OwnerID,Name")] OBC OBC)
        {
            if (id != OBC.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    OBC.IncrementEdition();

                    _context.Update(OBC);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OBCExists(OBC.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(OBC));
        }
예제 #2
0
        // GET: OBCs/CreateLike/5
        public async Task <IActionResult> Create(Guid id)
        {
            OBC obc = await _context.OBC.FirstOrDefaultAsync(o => o.ID == id);

            if (null != obc)
            {
                obc.Name         = "Like the " + obc.Name;
                obc.SerialNumber = "";
            }

            return(View(obc));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Platform,CPU,Voltage,FlashMemory,RAM,GPIOCount,AnalogPinCount,PWMPinCount,USBConnectorCount,PowerJack,USBPower,ResetButton,Wifi,Bluetooth,BLE,Out5V,Out3_3V,MaxSourceAmps,Description,Features,Manufacturer,Model,SerialNumber,Source,UnitPrice,Tax,Shipping,DateOfAcquisition,Height,Width,Depth,Weight,ID,OwnerID,Name")] OBC oBC)
        {
            if (ModelState.IsValid)
            {
                oBC.ID = Guid.NewGuid();
                _context.Add(oBC);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(oBC));
        }