Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using My20486_03_CalcMVC.Models;
- namespace My20486_03_CalcMVC.Controllers
- {
- public class CalcController : Controller
- {
- //
- // GET: /Calc/
- //just for demo!
- public ActionResult _Index()
- {
- double x=0, y=0;
- string operation = "";
- Calc1 calc1 = new Calc1();
- if (Request["x"] != null)
- {
- operation = Request["operation"];
- x = double.Parse(Request["x"]);
- y = double.Parse(Request["y"]);
- }
- calc1.X = x;
- calc1.Y = y;
- calc1.Operation = operation;
- //calc1.Plus();
- calc1.DoCalc();
- return View(calc1);
- }
- public ActionResult Index()
- {
- Calc1 calc1 = new Calc1();
- calc1.DoCalc();
- return View(calc1);
- }
- public ActionResult DoCalc(double x, double y, string operation)
- {
- Calc1 calc1 = new Calc1();
- calc1.X = x;
- calc1.Y = y;
- calc1.Operation = operation;
- calc1.DoCalc();
- return View("Index", calc1);
- }
- [HttpPost]
- public ActionResult DoCalc(Calc1 calc1)
- {
- calc1.DoCalc();
- return View("Index", calc1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement