Ejemplo n.º 1
0
        public ActionResult Reset(Calculator calc)
        {
            var db = new LastDbContext();

            foreach (var calcs in db.LastCalcs)
            {
                db.LastCalcs.Remove(calcs);
            }
            db.SaveChanges();

            return(RedirectToAction("Index", calc));
        }
Ejemplo n.º 2
0
        public ActionResult Calculate(decimal LeftOperand, decimal RightOperand, string Operator)



        {
            var        db   = new LastDbContext();
            Calculator calc = new Calculator();

            calc.LeftOperand  = LeftOperand;
            calc.RightOperand = RightOperand;
            calc.Operator     = Operator;
            calc.Calculate();

            db.LastCalcs.Add(calc);
            db.SaveChanges();



            return(RedirectToAction("Index", calc));
        }