0

I am developing services using Asp.Net Web Api. I am debating on design of our controllers. We have this common scenario where user will be presented with bunch of search field, once he enters the search criteria we will show summary of records (not the complete details), user will select one summary record and can go to details for this.

Ex.

class PersonSummary {
   string FirstName {get;set;}
   string LastName {get;set;}
   string Gender {get;set;}
}


class Person {
   string FirstName {get;set;}
   string LastName {get;set;}
   string Gender {get;set;}
   string SSN {get;set;} 
   string Race {get;set;}
   Address Address {get;set;}
}

User will search by user first\last name and we will show will list of PersonSummary records, he can select one PersonSummary to look at the details (Person record).

Now is it best design that we go with two controllers PersonSummaryController and PersonController?

Thank you.

1 Answer 1

4

I don't see a need for two controllers. You're dealing with one type of resource (Person), but asking for data in two formats (summary and detail). I would leave it at one controller and go on with life.

1
  • I agree. Go on and don't stop even someone shout "SRP" out loud.
    – tia
    Jan 1, 2015 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.