public ActionResult DeleteAndReturnJson(string name) { MyMockDataStorage.Remove(new Book() { BookName = name }); return(Json(new { status = "success", id = name })); }
public IActionResult AddBook(Book model) { if (ModelState.IsValid) { MyMockDataStorage.Add(model); return(PartialView("_AddedSuccessfully")); } return(PartialView("_AddBook", model)); }
public IActionResult AddBookAndReturnNewList(Book model) { if (ModelState.IsValid) { MyMockDataStorage.Add(model); var list = MyMockDataStorage.GetAll(); return(PartialView("_BookList", list)); } return(PartialView("_AddBook", model)); }
public ActionResult DeleteAndReturnJList(string name) { MyMockDataStorage.Remove(new Book() { BookName = name }); var list = MyMockDataStorage.GetAll(); return(PartialView("_BookList", list)); }
public IActionResult Index() { var books = MyMockDataStorage.GetAll(); var vm = new BookIndexVm() { Books = books }; return(View(vm)); }