Esempio n. 1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Items.Clear();
                var items = await repository.GetAll();

                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 2
0
        public ActionResult GetAllItemForSelect()
        {
            var repository = new ItemsRepository(_context);

            return(Ok(repository.GetAll()
                      .Select(r => new SelectItem(r.ID.ToString(), r.Supplier + " - " + r.ItemName))
                      .ToList()));
        }
        public IHttpActionResult Get()
        {
            object callContextObj = null;

            if (Request.Properties.TryGetValue("CallContext", out callContextObj))
            {
                CallContext callContext = (CallContext)callContextObj;
            }

            return(Ok(ItemsRepository.GetAll().Select(i => ModelFactory.Create(i))));
        }
Esempio n. 4
0
        public ActionResult GetAllItem()
        {
            var repository            = new ItemsRepository(_context);
            IGridServer <Item> server = new GridServer <Item>(repository.GetAll(), Request.Query,
                                                              true, "itemsGrid", ColumnCollections.ItemColumns)
                                        .WithPaging(10)
                                        .Sortable()
                                        .Filterable()
                                        .WithMultipleFilters()
                                        .WithGridItemsCount();

            var items = server.ItemsToDisplay;

            return(Ok(items));
        }
Esempio n. 5
0
        public static int GetNextFreeTelephoneNumber()
        {
            RoleplayContext ctx = Singletons.RoleplayContextFactory.Create();

            using (ItemsRepository repository = new ItemsRepository(ctx))
            {
                IEnumerable <int> numbers = repository.GetAll()
                                            .Where(i => i.ItemEntityType == ItemEntityType.Cellphone && i.ThirdParameter.HasValue)
                                            .Select(i => i.ThirdParameter.Value);

                int freeTelephoneNumber = Utils.RandomRange(100000);

                int[] numbersArray = numbers as int[] ?? numbers.ToArray();
                while (numbersArray.Any(number => number == freeTelephoneNumber))
                {
                    freeTelephoneNumber = Utils.RandomRange(100000);
                }

                return(freeTelephoneNumber);
            }
        }
Esempio n. 6
0
 //Get Items
 public IEnumerable <Item> GetAll()
 {
     return(_repo.GetAll());
 }
        public IActionResult Index()
        {
            var allItems = itemsRepository.GetAll();

            return(View(allItems));
        }
Esempio n. 8
0
 public void OnGet()
 {
     AllItems  = _mItem.GetAll();
     AllGroups = mGroup.GetAll();
 }
 public List <Burger> GetBurgers()
 {
     return(_repo.GetAll().ToList());
 }