0

I am making a pretty complex "calculator" as a web API. So that I can POST the input to the ASP.NET Web API, and then it returns the appropriate answers/reports.

I am just wondering how the architecture of this should be. I now have an api controller which takes the input, and binds it to a Input model, which stores all the input.

Where should the calculations be done? In the same model? Or should I make a Calculation model which contains all the business logic, and then I call the appropriate methods and such from the api controller?

Balle
  • 71
  • 8

1 Answers1

0

I am making a pretty complex "calculator" ...
Where should the calculations be done?

IIUC, that means there are some complex business rules needs to be designed. A good way to address complex models is to follow the Domain Driven Design (DDD) practices. That has nothing in common with REST.

should I make a Calculation model which contains all the business logic, and then I call the appropriate methods and such from the api controller?

As soon as you implement the business logic in the Domain layer, you may expose that to (web) clients using RESTful API.

Community
  • 1
  • 1
Serhii Shushliapin
  • 2,528
  • 2
  • 15
  • 32