コード例 #1
0
        public void Test3()

        {
            var i = new ItemLogic()
            {
                ItemId = 1, ItemName = "Pizza", ItemSize = "small"
            };

            var m = ItemLogic.AddItem(i);

            var actual = ItemLogic.DeleteAllItems();

            Assert.True(actual);
        }
コード例 #2
0
        public ActionResult Index(ItemViewModel itemViewModel)
        {
            Item item = _Logic.AddItem(itemViewModel);

            if (item != null)
            {
                ViewBag.Message = "Item is Added Successfully";
                return(View(_Logic.getItemViewModel()));
            }

            ViewBag.Message = "There is an error adding Item";
            return(View(_Logic.getItemViewModel()));
            //return Json(new { Success = true, Message = "Item is Added Successfully" },JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
ファイル: ItemController.cs プロジェクト: Hrajr/DB
        public IActionResult SubmitItem(IFormCollection formCollection)
        {
            if (!ModelState.IsValid)
            {
                return(View("AddItem"));
            }
            var newItem = new Item
            {
                Description = formCollection["Description"],
                VAT         = Convert.ToInt16(formCollection["VAT"]),
                Price       = Convert.ToDouble(formCollection["Price"]),
                Amount      = Convert.ToInt16(formCollection["Amount"])
            };

            if (_itemLogic.AddItem(newItem))
            {
                return(View("AddItem"));
            }
            return(View("Item"));
        }
コード例 #4
0
        public void Test2()

        {
            var i = new ItemLogic()
            {
                ItemId = 1, ItemName = "Pizza", ItemSize = "Huge"
            };

            var i1 = new ItemLogic()
            {
                ItemId = 2, ItemName = "Pizza", ItemSize = "big"
            };

            var m = ItemLogic.AddItem(i);

            var n = ItemLogic.AddItem(i1);

            var actual = ItemLogic.DeleteSingleItem(m.ItemId);

            Assert.True(actual);
        }