public ActionResult Create(history history) { if (ModelState.IsValid) { db.history.Add(history); db.SaveChanges(); return RedirectToAction("Index"); } return View(history); }
public ActionResult Create(history history) { apiController a = new apiController(); ViewBag.cur1 = "USD/TRY: " + a.get("getlatest", "usd", "try"); ViewBag.cur2 = "EUR/TRY: " + a.get("getlatest", "eur", "try"); ViewBag.cur3 = "GBP/TRY: " + a.get("getlatest", "gbp", "try"); string id = (Session["id"] != null) ? Session["id"].ToString() : "-1"; int intId = Convert.ToInt32(id); history.userId = intId; history.result=a.get(history.date1, history.date2, history.cur1, history.cur2, history.amount); if (ModelState.IsValid) { db.history.Add(history); db.SaveChanges(); return RedirectToAction("Index"); } return View(history); }
public ActionResult Edit(history history) { if (ModelState.IsValid) { db.Entry(history).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(history); }