示例#1
0
        public CustomerProfileModel CustomerProfile(int CustId)
        {
            using (var db = new EntityContext())
            {
                TbCustomer          customer            = customerUtility.GetCustomerById(db, CustId);
                CustomerSingleModel customerModelSource = customerUtility.CustomerSingleModelProperty(customer);
                List <TbItems>      items = db.TbItems
                                            .Include(i => i.Customer)
                                            .Include(i => i.Status)
                                            .Where(i => i.Customer.Id == CustId).ToList();
                List <ItemSingleModel> itemsModelSource = new List <ItemSingleModel>();
                if (items != null)
                {
                    itemsModelSource = itemsUtility.AssingItemsProperty(items);
                }
                ;

                CustomerProfileModel profile = new CustomerProfileModel
                {
                    customerModel = customerModelSource,
                    itemsModel    = itemsModelSource
                };
                return(profile);
            }
        }