public async Task <IActionResult> Divide([FromBody] Number number) { _logger.LogInformation("start add method"); int result = 0; if (ModelState.IsValid) { FirstTable first = null; try { result = await CalculatorSoapClient.DivideAsync(number.IntA, number.IntB); _logger.LogInformation("result successful"); first = new FirstTable(); _db.firstTables.Add(first); await _db.SaveChangesAsync(); } catch (Exception ex) { _logger.LogInformation("Request dont coreect", ex); throw; } _db.secondTables.Add(new SecondTable(first.Id, result.ToString())); await _db.SaveChangesAsync(); _logger.LogInformation("Successful"); return(Ok(result)); } return(BadRequest()); }
public ActionResult DeleteConfirmed(int id) { FirstTable firstTable = db.FirstTables.Find(id); db.FirstTables.Remove(firstTable); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CarID,ProductID,Speed")] FirstTable firstTable) { if (ModelState.IsValid) { db.Entry(firstTable).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(firstTable)); }
public ActionResult Create([Bind(Include = "CarID,ProductID,Speed")] FirstTable firstTable) { if (ModelState.IsValid) { db.FirstTables.Add(firstTable); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(firstTable)); }
// GET: FirstTables/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FirstTable firstTable = db.FirstTables.Find(id); if (firstTable == null) { return(HttpNotFound()); } return(View(firstTable)); }
/// <exception cref="NotComputedException"></exception> public static FirstComputer Compute(LL1Algo algo) { _ = algo.Nullable ?? throw new NotComputedException(nameof(algo.Nullable)); var iterations = new List <FirstTable>(); var first = new FirstTable(); // initialize first iteration foreach (var A in algo.Thecfg.Nonterminals) { first.Add(A, new FirstResult()); } do { if (iterations.Count == 0) { iterations.Add(first); } else { iterations.Add(DictUtil.Clone(first)); } first = iterations.Last(); foreach (var prod in algo.Thecfg.Productions) { foreach (var Bi in prod.Rhs) { if (Bi.Type == Symbol.Types.Terminal) { first[prod.Lhs].Add(Bi); break; } else { first[prod.Lhs].UnionWith(first[Bi]); } if (!algo.Nullable[Bi]) { break; } } } // stop loop if no changes between iterations } while (iterations.Count == 1 || !DictUtil.Equal(first, iterations[iterations.Count - 2])); return(new FirstComputer(algo, iterations)); }
public void OneTimeSetUp() { factory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); using (var db = factory.OpenDbConnection()) { db.DropAndCreateTable <FirstTable>(); db.DropAndCreateTable <SecondTable>(); var a = new FirstTable() { Deleted = false }; db.Save(a); db.Insert(new SecondTable() { FirstTableId = a.Id, Deleted = false }); } }