Example #1
0
 public ActionResult Edit(history history)
 {
     if (ModelState.IsValid)
     {
         db.Entry(history).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(history));
 }
Example #2
0
        public ActionResult Edit(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");

            if (ModelState.IsValid)
            {
                string sid   = (Session["id"] != null) ? Session["id"].ToString() : "-1";
                int    intId = Convert.ToInt32(sid);
                history.userId = intId;

                db.Entry(history).State = EntityState.Modified;
                history.result          = a.get(history.date1, history.date2, history.cur1, history.cur2, history.amount);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(history));
        }