Q:

How to remove duplicate entries in ASP.Net MVC Index View table

I have the following scenario:
I have a Contact with properties FirstName and  LastName. A Contact can have multiple PhoneNumbers and as many EmailAddresses. I have identified these as 3 entities with common relationships. Please see the table definitions below:
create table Contact
(
    ID int primary key not null identity(1,1),
    FirstName nvarchar(40),
    LastName nvarchar(40)
);
go

create table ContactNumber
(
    ID int primary key not null identity(1,1),
    PhoneNumber nvarchar(40)
);
go

create table EmailAddress
(
    ID int primary key not null identity(1,1),
    EmailAddress nvarchar(40)
);
go

create table UserContact
(
    ID int primary key not null identity(1,1),
    ContactID int foreign key references Contact(ID),
    ContactNumberID int foreign key references ContactNumber(ID),
    EmailID int foreign key references EmailAddress(ID)
);
go

Now I need to display these users in a Web Application of my choice. I chose C# MVC with a Razor Engine for the View. I'm battling to model this view in a table. The table needs Action Links to edit, delete, create a new contact and view the details of the contact. I want the result set to show as below:
FirstName | LastName | ContactNumber | EmailAddress
-------------------------------------------------------
James     | Smith    | 082 111 5454  | james@domain1.com | edit | details | delete
                                     | james@domain2.com
                                     | james@domain3.com
--------------------------------------------------------
Luther    | Arnolds  | 082 111 5455  | luther@domain1.com | edit | details | delete
                     | 082 111 5456  |
--------------------------------------------------------
Sarah     | Jones    | 082 111 5510  |  sarah@domain.com  | edit | details | delete
---------------------------------------------------------
          |          |               |

However I'm just not finding the write way to translate the ContactNumberID and EmailID columns from UserContact to map from their corresponding bridging tables. The issue that I am facing right now is that it is duplicating the records in UserContact thus making the table contain a lot of redundant data. For example the record for James Smith would be repeated 3 times. How can I achieve this in ASP.Net MVC without any duplication of entries?

A:

I would do something like this. Notice that I changed up the column names a little bit. It is a pet peeve of mine to have a column named ID. It is a ContactID (or whatever) regardless of which table it is in. I also really dislike column names changing for the same piece of data in related tables.
create table Contact
(
    ContactID int primary key not null identity(1,1),
    FirstName nvarchar(40) not null,
    LastName nvarchar(40) not null
);
go

create table ContactNumber
(
    ContactNumberID int primary key not null identity(1,1),
    PhoneNumber nvarchar(40) not null,
    ContactID int not null,
    constraint FK_ContactNumber_Contact_ContactID Foreign Key (ContactID) references Contact(ContactID)
);
go

create table EmailAddress
(
    EmailAddressID int primary key not null identity(1,1),
    EmailAddress nvarchar(40) not null,
    ContactID int not null,
    constraint FK_EmailAddress_Contact_ContactID Foreign Key (ContactID) references Contact(ContactID)
);
go

