public ActionResult DivOption(CalcModel Model) { var result = new CalcResultModel(); CalcService Service = new CalcService(); result.result = Service.Divide(Model); return(Ok(result)); }
public IActionResult Divide(string a, string b) { if (a.Equals("0")) { return(BadRequest("Cannot divide by 0")); } var result = _calcService.Divide(Int32.Parse(a), Int32.Parse(b)); return(Ok(result)); }
public ObjectResult Divide([FromQuery] double num1, [FromQuery] double num2) { if (num2 == 0) { return(BadRequest("num2 shouldn't be 0!")); } var calcResult = _service.Divide(num1, num2); string result = _calcResults.Decorate(num1, num2, calcResult, "Div"); return(Ok(result)); }
public IActionResult Divide(CalcModel model) { if (model.num1.Equals("0")) { return(BadRequest("Cannot divide by 0")); } var result = _calcService.Divide(Int32.Parse(model.num1), Int32.Parse(model.num2)); model.result = result; return(View(model)); }