Example #1
0
        public ActionResult Create(history history)
        {
            if (ModelState.IsValid)
            {
                db.history.Add(history);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(history));
        }
        public ActionResult Register(FormCollection form)
        {
            bool   isLogin = false;
            string id      = (Session["id"] != null) ? Session["id"].ToString() : "-1";

            if (id != "-1")
            {
                isLogin = true;
            }
            else
            {
                isLogin = false;
            }
            if (isLogin)
            {
                return(RedirectToAction("Index", "Forex"));
            }
            else
            {
                ForexHistoryEntities db = new ForexHistoryEntities();
                member add = new member();
                add.name         = form["name"].Trim();
                add.surName      = form["surName"].Trim();
                add.eMailAddress = form["eMailAddress"].Trim();
                add.setPassword(form["password"]);
                db.member.Add(add);
                db.SaveChanges();
                return(RedirectToAction("Login"));
            }
        }
Example #3
0
        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));
        }