コード例 #1
0
        public ActionResult DeleteAndReturnJson(string name)
        {
            MyMockDataStorage.Remove(new Book()
            {
                BookName = name
            });

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

                return(PartialView("_AddedSuccessfully"));
            }
            return(PartialView("_AddBook", model));
        }
コード例 #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));
 }
コード例 #4
0
        public ActionResult DeleteAndReturnJList(string name)
        {
            MyMockDataStorage.Remove(new Book()
            {
                BookName = name
            });
            var list = MyMockDataStorage.GetAll();

            return(PartialView("_BookList", list));
        }
コード例 #5
0
        public IActionResult Index()
        {
            var books = MyMockDataStorage.GetAll();
            var vm    = new BookIndexVm()
            {
                Books = books
            };

            return(View(vm));
        }