コード例 #1
0
        public async Task <ActionResult <IOUnit> > PostIOUnit(IOUnit iOUnit)
        {
            _context.IOUnits.Add(iOUnit);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetIOUnit", new { id = iOUnit.IOUnitId }, iOUnit));
        }
コード例 #2
0
ファイル: IOUnitsController.cs プロジェクト: Pete9000/H6
        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));
        }
コード例 #3
0
        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());
        }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
ファイル: IOUnitsController.cs プロジェクト: Pete9000/H6
        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));
        }