public IActionResult Create([Bind("Id,Name,Description,Price,Sku,StockQty,Weight,Length,Width,Height")] Page page) { if (ModelState.IsValid) { _pageLogic.Add(page); return(RedirectToAction(nameof(Index))); } return(View(page)); }
public void AddPage() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var PageLogic = new PageLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new UserDTO("Liza", UserType.Manager, "Bril", "Login", "Password")); UserLogic.Login("Login", "Password"); PageLogic.Add(new PageDTO("New page", "Content")); Assert.AreEqual(PageLogic.PageIEnum().Count(), 1); Assert.AreEqual(PageLogic.PageIEnum().ToList()[0].Title, "New page"); Assert.AreEqual(PageLogic.PageIEnum().ToList()[0].PagesContent, "Content"); }