Beispiel #1
0
        public ActionResult DeleteItem(int id)
        {
            ItemBL      itemBL   = new ItemBL();
            List <Item> itemList = itemBL.GetItems();
            Item        item     = itemList.Where(u => u.ItemId == id).Single();

            itemBL.DeleteItem(item);

            ShopVM shopVM = new ShopVM();

            shopVM.shop = itemBL.GetItems();

            return(RedirectToAction("Shop", "Home", shopVM));
        }
Beispiel #2
0
        public ActionResult OrderMenu()
        {
            var itemBL = new ItemBL();

            ViewBag.Data = itemBL.GetItems();
            return(View());
        }
Beispiel #3
0
        public ActionResult EditItem(int id)
        {
            ItemBL      itemBL   = new ItemBL();
            List <Item> itemList = itemBL.GetItems();
            Item        item     = itemList.Where(u => u.ItemId == id).Single();

            return(View(item));
        }
Beispiel #4
0
        public ActionResult Shop()
        {
            ItemBL itemBL = new ItemBL();
            ShopVM shopVM = new ShopVM();

            shopVM.shop = itemBL.GetItems();
            return(View(shopVM));
        }
 //public object GetPayments([FromBody()] Filter[] filters, int pageNumber, int pageSize, string paymentID)
 //{
 //    var paymentBL = new PaymentBL();
 //    return paymentBL.GetPayments(pageNumber, pageSize, filters, paymentID);
 //}
 //[HttpPost]
 //[Route("invoice/{pageNumber}/{pageSize}/{paymentID}")]
 //[Authorize]
 public ActionResult EmployeeList()
 {
     try
     {
         var itemBL = new ItemBL();
         ViewBag.Data = itemBL.GetItems();
         return(View());
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #6
0
 public List <Item> GetItemByName([FromBody] string name)
 {
     try
     {
         var         itemBL = new ItemBL();
         List <Item> items  = itemBL.GetItems();
         return(items.Where(i => i.ItemName.Contains(name)).ToList());
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #7
0
        // GET: api/Unit
        public ServerResponse Get()
        {
            var res = new ServerResponse();

            using (ItemBL itemBL = new ItemBL())
            {
                try
                {
                    res.Data = itemBL.GetItems();
                }
                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
Beispiel #8
0
        public ActionResult Order(int id)
        {
            if (Session["login"] == null)
            {
                return(View("Login"));
            }
            ItemBL      orderBL = new ItemBL();
            List <Item> list    = orderBL.GetItems();
            Item        item    = list.Where(u => u.ItemId == id).Single();

            OrderVM orderVM = new OrderVM();

            orderVM.item       = item;
            orderVM.order      = new Models.Order();
            orderVM.order.item = item.name;
            return(View("Order", orderVM));
        }
        public AjaxResult Get()
        {
            var result = new AjaxResult();

            try
            {
                result.Success = true;
                var itemBL = new ItemBL();
                result.Data = itemBL.GetItems();
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Data    = ex;
                throw;
            }
            return(result);
        }
        public void GetItemsTest()
        {
            List <Items> items = iBl.GetItems();

            Assert.NotNull(items);
        }
 public static List <ItemVM> GetItems(string cat, string desc, double threshold)
 {
     return(ItemBL.GetItems(cat, desc, threshold));
 }
Beispiel #12
0
        public void showItems()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine(row);
                Console.WriteLine("MENU");
                Console.WriteLine(row);
                ItemBL       itemBL = new ItemBL();
                List <Items> li     = null;
                try
                {
                    li = itemBL.GetItems();
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                }
                var table = new ConsoleTable("ID", "ITEM'S NAME", "PRICE OF SIZE M", "PRICE OF SIZE X", "PRICE OF SIZE XL");
                foreach (Items item in li)
                {
                    table.AddRow(item.ItemID, item.ItemName, FomatMoney(item.ItemPrice), FomatMoney(item.ItemPrice + 5), FomatMoney(item.ItemPrice + 10));
                }
                table.Write();

                string selction;

                Console.WriteLine("1. View item detail.");
                Console.WriteLine("2. Search item.");
                Console.WriteLine("3. Back.");
                Console.Write("Enter your selection: ");

                selction = Console.ReadLine();
                switch (selction)
                {
                case "1":
                    int    itID;
                    string choice;
                    while (true)
                    {
                        try
                        {
                            li = itemBL.GetItems();
                            Console.Write("Enter item id: ");
                            itID = int.Parse(Console.ReadLine());

                            break;
                        }
                        catch (System.Exception)
                        {
                            Console.WriteLine("Item id must be integer and in the options !");
                            continue;
                        }
                    }
                    if (itID > li.Count || validateChoice(itID.ToString()) == false)
                    {
                        Console.Write("You are only entered in the number of existing ids !");
                        while (true)
                        {
                            Console.Write("Do  you want re-enter ? (Y/N): ");
                            choice = Console.ReadLine().ToUpper();
                            if (choice != "Y" && choice != "N")
                            {
                                Console.Write("You can only enter  (Y/N): ");
                                choice = Console.ReadLine().ToUpper();
                                continue;
                            }
                            break;
                        }

                        switch (choice)
                        {
                        case "Y":
                            continue;

                        case "N":
                            showItems();
                            break;

                        default:
                            continue;
                        }
                    }
                    showItemDetail(itID);
                    break;

                case "2":
                    string str;
                    int    temp = 0;
                    Console.InputEncoding = Encoding.Unicode;

                    Console.Write("Enter the item to search: ");
                    str = Console.ReadLine().Trim();

                    var tables = new ConsoleTable("ID", "ITEM'S NAME", "PRICE OF SIZE M", "PRICE OF SIZE X", "PRICE OF SIZE XL");
                    foreach (var item in li)
                    {
                        if (item.ItemName.ToUpper().Contains(str.ToUpper()))
                        {
                            tables.AddRow(item.ItemID, item.ItemName, FomatMoney(item.ItemPrice), FomatMoney(item.ItemPrice + 5), FomatMoney(item.ItemPrice + 10));
                            temp = 1;
                        }
                    }
                    if (temp == 0)
                    {
                        Console.WriteLine("No items found, press anykey to continue !");
                        Console.ReadKey();
                        break;
                    }
                    Console.Clear();
                    Console.WriteLine("RESULT FOR: {0}\n", str);
                    tables.Write();
                    int    itemid;
                    string choicee;
                    while (true)
                    {
                        try
                        {
                            li = itemBL.GetItems();
                            Console.Write("Enter item id: ");
                            itemid = int.Parse(Console.ReadLine());

                            break;
                        }
                        catch (System.Exception)
                        {
                            Console.WriteLine("Item id must be integer and in the options !");
                            continue;
                        }
                    }
                    if (itemid > li.Count || validateChoice(itemid.ToString()) == false)
                    {
                        Console.Write("You are only entered in the number of existing ids !");
                        while (true)
                        {
                            Console.Write("Do  you want re-enter ? (Y/N): ");
                            choicee = Console.ReadLine().ToUpper();
                            if (choicee != "Y" && choicee != "N")
                            {
                                Console.Write("You can only enter  (Y/N): ");
                                choice = Console.ReadLine().ToUpper();
                                continue;
                            }
                            break;
                        }

                        switch (choicee)
                        {
                        case "Y":
                            continue;

                        case "N":
                            showItems();
                            break;

                        default:
                            continue;
                        }
                    }
                    showItemDetail(itemid);
                    Console.ReadKey();
                    break;

                case "3":
                    MenuAfterLogin();
                    break;

                default:
                    Console.WriteLine("You must enter integer and in the option !");
                    Console.ReadKey();
                    break;
                }
            }
        }