The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

daveharney (15) [Avatar] Offline
#1
Although chapters 6, 7 and 8 were well written with plenty of useful info, I wanted to “Play Along” but it wasn’t always easy to do that. I understand that the first half of the book is your “Whistle-Stop Tour” of Core but I get bored without some coding exercises – perhaps others will feel the same.

So, I have two suggestions:

1. Give some guidance as to where in a chapter it would be most appropriate to start a coding exercise.
2. When appropriate, provide working code examples that demonstrate the concepts being explored – perhaps on GitHub

For example, in chapter 7, I was trying to follow the concepts by working with a small VS2017 project and got a bit lost when I couldn’t find the model class for the ToDoItemViewModel. I created my own class and then changed some of the example code a bit to follow the book – and perhaps not what you intended. But the bigger issue is that I spent time fooling around with coding bugs, when I’d rather have spent that time working with your book. This is the class I fumbled around to create for the ToDoItemViewModel:

public class ToDoItemViewModel
 {
    public string Title { get; set; }
    public bool IsComplete { get; set; }
    public List<taskObject> tasklist { get; set; }
 }
public class taskObject : IEnumerable
  {
    public string taskname { get; set; }
    public IEnumerator GetEnumerator()
      {
        throw new NotImplementedException();
      }
  }

And then I fiddled with the controller:
public IActionResult ViewTodo(int id)
  {
     List<taskObject> mylist = new List<taskObject>();
     mylist.Add(new taskObject() {taskname="Get Fuel" });
     mylist.Add(new taskObject() { taskname = "<strong>Check Oil</strong>" });
     mylist.Add(new taskObject() { taskname = "Check tire pressure" });

     var viewModel = new ToDoItemViewModel
        {
          Title = "Tasks for today",
          //IsComplete = true,
          IsComplete = false,
          tasklist = mylist
        };
        if (viewModel.IsComplete)
         {
            ViewData["Message"] = "";
         }
         else
          {
            ViewData["Message"] = "The following tasks Remain - Get Busy Now!";
          }
           return View(viewModel);

And then the view:
@model ToDoItemViewModel

<h1>@Model.Title</h1>

<h4>@ViewData["Message"]</h4>

@if (Model.IsComplete)
{
    <strong>Well done, you’re all done!</strong>
}
else
{
    @foreach (var eachTask in Model.tasklist)
    {
      <li>@Html.Raw(eachTask.taskname)</li>
    }
}



Having some examples like this - of what you originally created - up on GitHub would have kept me more focused on your book. Just a suggestion, perhaps not as important to many readers.

Chapter 8, page 221 perhaps mention the need to create an instance of the model in the controller
public class TestSelectController : Controller
    {
        public IActionResult Index()
        {
            var vm = new SelectListsViewModel();
            return View(vm);
        }
    }



Page 222:

Change one of - MultiValues vs MutilValues1 to be consistent

Asp-for=”Model.SelectedValue1” should not have “Model”

In any event, these are great chapters and I look forward all of the rest of book - very helpful in learning about Core - best book I've found for Core.


Andrew Lock (51) [Avatar] Offline
#2
Hi Dave,

Great feedback as always - adding exercises is definitely something I'm looking at doing, so hopefully that will help cement the concepts. Just to let you know, Manning have since added the code samples for the book to the dashboard, so you should be able to see them by going to https://account.manning.com/dashboard and clicking the </> symbol!

Hope you find them useful!

Thanks again
Andrew
Rhywun (27) [Avatar] Offline
#3
I was going to say something very similar. I'm in Chapter 6 and while I appreciate the source code and the readme.md provided, I'm still finding it somewhat difficult to follow along because the connection between the text and the code examples is not as clear as it could be. Some of the snippets in the book aren't in the code samples so my eyes just glaze over those parts because I don't want to set up a whole project just to try them out.

In contrast, I was going to commend chapter 3 for having a very clear connection between the text and the code examples.

I don't know what could be done differently besides maybe more clearly pointing out which solution goes with which section of the book and maybe taking the samples in the book directly from the source code, providing the filenames, etc.

Thanks