public async Task <JsonResult> FindItem([FromQuery] string name_or_no)
 {
     try
     {
         return(await _itemLogic.FindItem(name_or_no).ConfigureAwait(false));
     }
     catch (Exception ee)
     {
         return(await _itemLogic.SendRespose("False", ee.Message).ConfigureAwait(false));
     }
 }
Example #2
0
        public void FindItem()
        {
            var search             = "Pepperoni";
            List <ItemLogic> Items = new List <ItemLogic>();
            var uno = new ItemLogic {
                ItemId = 1, ItemName = "Pepperoni", ItemSize = "Large"
            };
            var dos = new ItemLogic {
                ItemId = 2, ItemName = "Meat Lovers", ItemSize = "Small"
            };
            var tres = new ItemLogic {
                ItemId = 3, ItemName = "Tequila", ItemSize = "XXXXXXXXL"
            };

            Items.Add(uno);
            Items.Add(dos);
            Items.Add(tres);

            var actual = ItemLogic.FindItem(Items, search);

            Assert.Equal(uno.ItemName, search);
        }