© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
16 replies
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)
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

.Net framework async controllers
C#CC# / help
11mo ago
✅ Only add certain controllers?
C#CC# / help
3y ago
Purpose of Dependency Injection
C#CC# / help
2y ago
✅ Understanding how to build controllers.
C#CC# / help
4mo ago