Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return descriptions to the interface
Message
De
23/10/2015 08:08:21
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01626353
Message ID:
01626367
Vues:
50
>Hi everybody,
>
>I'm thinking what would be the best way for the following scenario.
>
>I have the Sales Channel table and a related table called ScSgLink, where Sg stands for sales points group and has a link to the Sales Points Groups.
>
>I implemented this for the GetById in that SChannels Repository:
>
>
> public override SChannels GetById(object id)
>        {
>            var sChannel = _siriusContext.SChannels.Include("ScsgLink")            
>             
>             .Where(x => x.ChannelId == (Int32)id)
>             .First();
>
>
>            return sChannel;
>        }
>
>That correctly returns collection of the ScSgLink objects.
>
>My problem is that I want to also show group description which is in another table.
>
>My current EditViewModel has the following:
>
>
>  public int ChannelId { get; set; }
>        
>        [Display(Name = "descrip", ResourceType = typeof(Labels))]
>        public string Descrip { get; set; }
>        
>        public string CUdf1 { get; set; }
>        
>        public string CUdf2 { get; set; }
>        
>        public bool Hidden { get; set; }
>
>        //public System.Collections.Generic.ICollection<Siriusware.Models.Max4Sale> Max4Sale { get; set; }
>
>        public System.Collections.Generic.ICollection<Siriusware.Models.ScsgLink> ScsgLink { get; set; }
>
>I need to somehow display the group description in the interface and here I am not sure of the good way to implement it.
>
>I can create another class to add description and use that class in the ICollection or I can add the GroupDescription to the ScsgLink class (as a partial class with that new property).
>
>The problem is that I don't know exactly how to retrieve it. Assuming I've added GroupDescription property to the ScsgLink class how should I modify the GetById method to grab it as well? It is coming from the SpGroup table (
>
>public int GroupNo { get; set; } // group_no (Primary key). Primary key
>        public string Descrip { get; set; } // descrip)
>
>Thanks in advance.

use a linq join
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform