troubleshooting Question

Alter MVC 3 Repository class after Scaffolding generation

Avatar of AkAlan
AkAlan asked on
.NET ProgrammingASP.NETWeb Frameworks
6 Comments1 Solution501 ViewsLast Modified:
I have a model class that is used as a lookup for another model class (Log_ReqHeader).

public partial class LOG_OrgCodes
        public LOG_OrgCodes()
            this.LOG_ReqHeader = new HashSet<LOG_ReqHeader>();
        public string ID { get; set; }
        public string OrgDesc { get; set; }
        public string SiteCode { get; set; }
        public bool Obsolete { get; set; }

        public virtual ICollection<LOG_ReqHeader> LOG_ReqHeader { get; set; }

After generating the view, controller and repository I end up with a method "All". this method is returning all the OrgCodes along with the collection of all the Log_ReqHeader information which I don't want.  I want to create a new method to return only the OrgCode information but am hitting a wall. I copied the All method and added an interface to it but now I am not sure of the syntax to select only the OrgCodes without the Log_ReqHeader data. Thanks in advance for any help.

public IQueryable<LOG_OrgCodes> AllOrgCodes

            get { return context.LOG_OrgCodes; }
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros