Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:29:58+00:00 2026-06-09T09:29:58+00:00

Should T be a for example Customer or CustomerViewModel ? The annotations bound to

  • 0

Should T be a for example Customer or CustomerViewModel ?

The annotations bound to Mvc namespace are on the ListViewModel so actually I could pass the Customer object. What do you think?

public class ListViewModel<T>
{
        [Required(ErrorMessage="No item selected.")]
        public int[] SelectedIds { get; set; }
        public IEnumerable<T> DisplayList { get; set; }        
}

UPDATE

[HttpGet]
 public ActionResult Open()
 {
    IEnumerable<Testplan> testplans = _testplanDataProvider.GetTestplans();
    OpenTestplanListViewModel viewModel = new OpenTestplanListViewModel(testplans);         
    return PartialView(viewModel);
 }

public class OpenTestplanListViewModel
{
        public OpenTestplanListViewModel(IEnumerable<Testplan> testplans)
        {
           var testplanViewModels = testplans.Select(t => new TestplanViewModel
           {
             Name = string.Format("{0}-{1}-{2}-{3}", t.Release.Name, t.Template.Name, t.CreatedAt, t.CreatedBy),
              TestplanId = t.TestplanId,
           });

           DisplayList = testplanViewModels;
        }

        [Required(ErrorMessage = "No item selected.")]
        public int[] SelectedIds { get; set; }
        public string Name { get; set; }
        public IEnumerable<TestplanViewModel> DisplayList { get; private set; } 
}

public class TestplanViewModel
{
        public int TestplanId { get; set; }     
        public string Name { get; set; }           
}

 public class Testplan
 {
        public int TestplanId { get; set; }
        public int TemplateId { get; set; }
        public int ReleaseId { get; set; }
        public string CreatedBy { get; set; }       
        public DateTime CreatedAt { get; set; }       
        public Template Template { get; set; }
        public Release Release { get; set; } 
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:29:59+00:00Added an answer on June 9, 2026 at 9:29 am

    T should ideally be a view model. Having a view model referencing domain models is some kind of a hybrid view model, not a real one. But if you think that in this specific case the domain model will be exactly the same as the view model then you could keep it as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp>
The following jQuery example should put some text into the div, but it doesn't.
World's most convuluted title I know, an example should explain it better. I have
When using english the following URL should apply: http://example.org/services/myservice/ When using another language, the
For example Dim aInt as Integer should have the value as nothing instead of
I should probably not ask a generic question with a specific example, but I
Should I plan to parse/regex, for example, an entire url string retrieved from one
Should I frequently rely on default values? For example, in PHP, if you have
Should I include/require_once the parent class that I am extending in PHP? for example
guys please post me an example for threading in MFC....it should show the progress

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.