Question

ASP .NET MVC4

Class #1:

public class F61BPROD
{
    public int WPDOCO { get; set; }
    public string WPDCTO { get; set; }
    public string WPMCU { get; set; }
    public string WPLOCN { get; set; }
    public string WPDCT { get; set; }
    public int WPTRDJ { get; set; }
    public string WPKYPR { get; set; }
    public string WPLITM { get; set; }
    public decimal WPTRQT { get; set; }
    public string WPKYFN { get; set; }
    public string WPLOTN { get; set; }
    public string WPLRP1 { get; set; }
    public string WPLRP2 { get; set; }
    public string WPLRP3 { get; set; }
    public string WPLRP4 { get; set; }
    public string WPLRP5 { get; set; }
    public string WPLRP6 { get; set; }
    public string WPLRP7 { get; set; }
    public string WPLRP8 { get; set; }
    public string WPLRP9 { get; set; }
    public string WPLRP0 { get; set; }
    public string WPFLAG { get; set; }
    public string WPLOT1 { get; set; }
    public string WPLOT2 { get; set; }
}

For one of the properties of Class #1 i need to fetch one of Class #2:

    public class JDEItemBasic
    {
        public int itm { get; set; }
        public string litm { get; set; }
        public string dsc { get; set; }
        public string dsce { get; set; }
        public string ean14 { get; set; }
        public string cc { get; set; }
        public string uom1 { get; set; }
        public string uom2 { get; set; }
        public int uom1ea { get; set; }
        public int bxuom1 { get; set; }
        public int uom1gr { get; set; }
}

There is a DAL that gets the above classes. I need to combine these classes a new class that will have most of the properties of the above classes.

Should i create a third class and do the job in BLL?

or should i do it in UI using LINQ to Entities after i fetch them?

Was it helpful?

Solution

Should i create a third class and do the job in BLL?

or should i do it in UI using LINQ to Entities after i fetch them?

That would depend on where you need this class. If it is for displaying purposes then it should live in the UI. This class even has a name in this case: it's called a view model and is what your controller action could pass to the view after querying your DAL layer and projecting the various results to this view model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top