public async Task <ActionResult <IOUnit> > PostIOUnit(IOUnit iOUnit) { _context.IOUnits.Add(iOUnit); await _context.SaveChangesAsync(); return(CreatedAtAction("GetIOUnit", new { id = iOUnit.IOUnitId }, iOUnit)); }
public async Task <IActionResult> Edit(int id, [Bind("IOUnitId,Enabled,Name,DeviceId")] IOUnit iOUnit) { if (id != iOUnit.IOUnitId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(iOUnit); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IOUnitExists(iOUnit.IOUnitId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DeviceId"] = new SelectList(_context.Devices, "DeviceId", "MACAddress", iOUnit.DeviceId); return(View(iOUnit)); }
public async Task <IActionResult> PutIOUnit(int id, IOUnit iOUnit) { if (id != iOUnit.IOUnitId) { return(BadRequest()); } _context.Entry(iOUnit).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IOUnitExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// 虚拟机控制器构造函数 /// </summary> /// <param name="net_conn">网络连接创建组件</param> /// <param name="complex">复杂数学运算组件</param> /// <param name="time_path">时间组件文件路径</param> /// <param name="mem_size">内存大小(默认8MB)</param> /// <param name="mem_align">内存最小分配量</param> /// <param name="mem_offset">内存空闲空间分配差值</param> public VMController(INetConnect net_conn, IComplexOperation complex, string time_path = null, int mem_size = Memory_Size, short mem_align = Memory_Align, short mem_offset = Memory_Offset) { MemoryController = new MemoryUnit(mem_size, mem_align, mem_offset); IOController = new IOUnit(this); NetController = new NetUnit(net_conn, this); TimeTool = new Time(time_path); Complex = complex; SVM = null; }
public async Task <IActionResult> Create([Bind("IOUnitId,Enabled,Name,DeviceId")] IOUnit iOUnit) { if (ModelState.IsValid) { _context.Add(iOUnit); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DeviceId"] = new SelectList(_context.Devices, "DeviceId", "MACAddress", iOUnit.DeviceId); return(View(iOUnit)); }