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 9215447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:12:25+00:00 2026-06-18T02:12:25+00:00

Most tutorials don’t really cover this at all. They just say link your entity

  • 0

Most tutorials don’t really cover this at all. They just say link your entity to a controller and you’re done.

In my business model I have Customers and I have Customer Contacts 1 Customer to >1 Customer Contacts. How do I create a view model for these that will allow them to be edited/created/whatever from the same view?

public class Customer
{
    public Customer()
    {
        this.CustomerContacts = new List<CustomerContact>();
        this.Systems = new List<System>();
        this.CreatedByCustomerTickets = new List<Ticket>();
        this.CustomerTickets = new List<Ticket>();
    }

    public long CustomerID { get; set; }
    public Nullable<bool> BusinessCustomer { get; set; }
    public string CustomerName { get; set; }
    public string CustomerNotes { get; set; }
    public virtual ICollection<CustomerContact> CustomerContacts { get; set; }
    public virtual ICollection<System> Systems { get; set; }
    public virtual ICollection<Ticket> CreatedByCustomerTickets { get; set; }
    public virtual ICollection<Ticket> CustomerTickets { get; set; }
}

public class CustomerContact
{
    public long CustomerContactID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Phone { get; set; }
    public string AddressLine1 { get; set; }
    public string AddressLine2 { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public Nullable<int> Zip { get; set; }
    public Nullable<long> CustomerID { get; set; }
    public string Email { get; set; }
    public bool PromotionalEmails { get; set; }
    public virtual Customer Customer { 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-18T02:12:26+00:00Added an answer on June 18, 2026 at 2:12 am

    Well I’d start with this

    public class CustomerViewModel
    {
      public Customer Customer {get; set;}
      public CustomerContact CustomerContact {get; set;}
    }
    

    and work from there.

    If you don’t need all the properties from the domain objects, you may consider something more like:

    public class CustomerViewModel
        {
           public long CustomerID { get; set; }
           public ICollection<CustomerContact> CustomerContacts { get; set; }
        }
    

    It’s really up to you to construct your view models in a way that will meet the needs of your specific project.

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

Sidebar

Related Questions

I have a navigation controller with a table view. In most tutorials I've read
This time I have a more philosopical question. Most MVC tutorials/books seem to suggest
I have seen few tutorials that claim to solve this issue online but they
I found that most tutorials use one big router. For example: https://github.com/thomasdavis/backboneboilerplate/blob/gh-pages/js/router.js Wouldn't it
been working with symfony for a while. most tutorials describe having multiple actions in
Most of the tutorials around explain how to create a java applet: create a
With lots of efforts and tutorials I got xdebug/wincachegrind up and running but most
I'm using this tutorial to add a Login Item to my application. Most of
Most of this info isn't needed to answer my question, I am including it,
I've tried using some of the assembly tutorials around the web, and most of

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.