//funciona sin sobrecargar el metodo, validando si los parametros son nulos //public ActionResult Resta(string num1, string num2) { // if (num1 != null && num2 != null) { // int res = Calculadora.Restar(num1, num2); // ViewBag.RestaRes = res; // } // return View(); //} //Action Resta con binding automatico a traves del model public ActionResult Resta(CalculadoraModel model) { int R = model.Num1 + model.Num2; model.Result = R; //la vista es TIPADA return(View(model)); }
public override Task <CalculadoraModel> GetCalculadoraInfo(CalculadoraLookupModel request, ServerCallContext context) { CalculadoraModel output = new CalculadoraModel(); output.N1 = request.N1; output.N2 = request.N2; output.Soma = output.N1 + output.N2; output.Subtracao = output.N1 - output.N2; output.Multiplicacao = output.N1 * output.N2; output.Divisao = output.N1 / output.N2; return(Task.FromResult(output)); }
public ActionResult CalculadoraPartial(CalculadoraModel model) { model.Sumar(); return PartialView(model);//y aqui que hace? }
//Constructor public CalculadoraRepository() { modelo = new CalculadoraModel(); }