public static List <PromoItemsVM> GetPromotionItems()
        {
            List <PromoItemsVM> lstitems = new List <PromoItemsVM>();

            try
            {
                using (var context = new SCMEntity())
                {
                    var rtnmodel = (from s in context.PromoItems
                                    join i in context.Items on s.ItemId equals i.ItemId
                                    orderby i.ItemName
                                    select new PromoItemsVM
                    {
                        ItemId = s.ItemId,
                        PromoItemId = s.PromoItemId,
                        ItemName = i.ItemName,
                        PromotionalQty = s.PromotionalQty,
                        FixedPrice = s.FixedPrice,
                        GroupId = s.GroupId ?? 0
                    }).ToList();
                    return(rtnmodel);
                }
            }
            catch (Exception ex)
            {
                return(lstitems);
            }
        }
        public static List <Item> GetItems()
        {
            List <Item> lstitems = new List <Item>();

            try
            {
                using (var context = new SCMEntity())
                {
                    var rtnmodel = context.Items.OrderBy(x => x.ItemName).ToList();

                    return(rtnmodel);
                }
            }
            catch (Exception exe)
            {
                return(lstitems);
            }
        }
Exemple #3
0
 public HomeController(SCMEntity sCMEntity)
 {
     this.sCMEntity = sCMEntity;
 }