public async Task <IActionResult> PutBMachine([FromRoute] int id, [FromBody] BMachine bMachine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMachine.Id) { return(BadRequest()); } _context.Entry(bMachine).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMachineExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.userPref); Switch codeswitch = FindViewById <Switch>(Resource.Id.scSwitch); codeswitch.Checked = Application.Context.GetSharedPreferences("BNCODE", FileCreationMode.Private).GetBoolean("codeShow", false); codeswitch.CheckedChange += Codeswitch_CheckedChange; TextView tv2 = FindViewById <TextView>(Resource.Id.textView2); /* * @"<code> * <def type='0' value='0'>a</def> * <def type='0' value='0'>i</def> * <ivk type='1' vtype='0'>a</ivk> * <loop con='i<10'> * <code> * <calc>i=i+1</calc> * <ivk type='0'>(a*i).ToString()+""=""+a.ToString()+""*""+i.ToString()</ivk> * </code> * </loop> * </code> " 선택받은 단 출력예제 */ BMachine bm = new BMachine(@"<code> <def type='0' value='0'>a</def> <def type='1' value='0'>ipt</def> <loop con='a<4'> <code> <calc>a=a+1</calc> <ivk type='1' vtype='1'>ipt</ivk> <ivk type='0'>ipt</ivk> </code> </loop> </code> ", (string i) => { RunOnUiThread(() => { tv2.Text += i + System.Environment.NewLine; }); }); bm.Run(); System.Threading.Thread.Sleep(10000); while (!bm.Input("5")) { bm.Input("5"); } codePart cp = new codePart(); cp.Add(new definePart(DefType.Number, "nigg", "2")); XmlDocument doc = new XmlDocument(); doc.AppendChild(cp.XmlDigest(doc)); tv2.Text += doc.OuterXml + System.Environment.NewLine; //while (!bm.Input("5")) { } //while (!bm.Input("5")) { } //while (!bm.Input("5")) { } // Create your application here }
public async Task <IActionResult> PostBMachine([FromBody] BMachine bMachine) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMachine.Add(bMachine); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMachine", new { id = bMachine.Id }, bMachine)); }
public void Machine1() { string ans = ";"; BMachine bm = new BMachine(@"<code> <def type='0' value='23'>a</def> <calc>a=a+12</calc> <ivk type='0'>a</ivk> </code>", (string sd) => { ans = sd; }); bm.Step(); bm.Step(); bm.Step(); Assert.AreEqual("35", ans); }