예제 #1
0
        public IEnumerable <ItemBulletinViewModel> GetItemList(int check)
        {
            string emailAddress = HttpContext.Current.User.Identity.Name.ToString();

            if (!global.IsUniqueEmailAddress(emailAddress))
            {
                Account userAccount = global.GetAccount(emailAddress);
                List <ItemBulletinViewModel> itemList    = new List <ItemBulletinViewModel>();
                IEnumerable <Item>           itemResults = db.Item.Where(i => i.AccountId == userAccount.AccountId).ToList();
                if (itemResults != null)
                {
                    ItemBulletinViewModel writeModel;
                    foreach (Item i in itemResults)
                    {
                        bool confirmed = global.isConfirmedItem(i);
                        bool offered   = isOffered(check, i.ItemId);
                        if (!confirmed && !offered)
                        {
                            writeModel             = new ItemBulletinViewModel();
                            writeModel.ItemId      = i.ItemId;
                            writeModel.Name        = i.Name;
                            writeModel.Caption     = i.Caption;
                            writeModel.Description = i.Description;
                            itemList.Add(writeModel);
                        }
                    }
                }
                return(itemList);
            }
            return(null);
        }
        public IEnumerable <ItemBulletinViewModel> GetItemList()
        {
            string emailAddress = HttpContext.Current.User.Identity.Name.ToString();

            if (!global.IsUniqueEmailAddress(emailAddress))
            {
                Account userAccount = global.GetAccount(emailAddress);
                List <ItemBulletinViewModel> itemList    = new List <ItemBulletinViewModel>();
                IEnumerable <Item>           itemResults = db.Item.Where(i => i.AccountId == userAccount.AccountId).ToList();
                if (itemResults != null)
                {
                    ItemBulletinViewModel writeModel;
                    foreach (Item i in itemResults)
                    {
                        bool check = global.isConfirmedItem(i);
                        writeModel             = new ItemBulletinViewModel();
                        writeModel.ItemId      = i.ItemId;
                        writeModel.Name        = i.Name;
                        writeModel.Caption     = i.Caption;
                        writeModel.Description = i.Description;
                        Image itemImage = imaging.ServeImage(i);
                        if (itemImage != null)
                        {
                            writeModel.ImageSource = itemImage.ImageSource;
                        }
                        if (check)
                        {
                            writeModel.Status = 1;
                        }
                        itemList.Add(writeModel);
                    }
                }
                return(itemList);
            }
            return(null);
        }