public ActionResult AddBook(AddBookViewModel model) { var name = Request["Name"]; if (ModelState.IsValid) { Book book = new Book() { Name = model.Name, Isbn = model.Isbn, Price = model.Price, CategoryId = model.CategoryId, CreatedDate = DateTime.Now, CreatedBy = HttpContext.User.Identity.Name }; BookStoreService.SaveBook(book); //TempData["message"] = "Hello from Add Book"; return(RedirectToAction("Index")); } var categoryList = BookStoreService.GetCategoryList(); model.CategoryList = new SelectList(categoryList, "Id", "Name", model.CategoryId); //ModelState.AddModelError("", "Some other error such as Book Name already exist"); return(View(model)); }