C#C
C#4y ago
bookuha

Controllers purpose

I have an entity Book,
so far I seen examples where Controllers implement only simple CRUD operations, they get BookDTO, map it to the Book and update entirely.
The question is, if I want to do some specific logic on the book,
like add another author, what should I do?
Another method in controller with a specific route that only receives string and populates it to authors collection in Book object by use of service?
Or should I only have these CRUD methods and update it only entirely with this DTO I get from my client (sound very bad for me)
Also, do I map DTOs to Entities in controllers and pass entities to services? Or do I make services work with DTOs (also sounds bad to me)
Was this page helpful?