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); }
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); }
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")); }
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); }