Esempio n. 1
0
        public ActionResult DeleteAndReturnJson(string name)
        {
            MyMockDataStorage.Remove(new Book()
            {
                BookName = name
            });

            return(Json(new { status = "success", id = name }));
        }
Esempio n. 2
0
        public IActionResult AddBook(Book model)
        {
            if (ModelState.IsValid)
            {
                MyMockDataStorage.Add(model);

                return(PartialView("_AddedSuccessfully"));
            }
            return(PartialView("_AddBook", model));
        }
Esempio n. 3
0
 public IActionResult AddBookAndReturnNewList(Book model)
 {
     if (ModelState.IsValid)
     {
         MyMockDataStorage.Add(model);
         var list = MyMockDataStorage.GetAll();
         return(PartialView("_BookList", list));
     }
     return(PartialView("_AddBook", model));
 }
Esempio n. 4
0
        public ActionResult DeleteAndReturnJList(string name)
        {
            MyMockDataStorage.Remove(new Book()
            {
                BookName = name
            });
            var list = MyMockDataStorage.GetAll();

            return(PartialView("_BookList", list));
        }
Esempio n. 5
0
        public IActionResult Index()
        {
            var books = MyMockDataStorage.GetAll();
            var vm    = new BookIndexVm()
            {
                Books = books
            };

            return(View(vm));
        }