A8 Security: Authorization (Web Api Services) (Wpf) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Each security view model needs its own Web Api service even though the view model is a dummy(mock) class.

Note 1:

In "A7 Security: Authorization (ViewModels)"-article It was described of how to import ViewModel definition. Not only the ViewModels definitions were imported, but also the Web Api service definitions. Thus, there is no need to make any customizations before generating the code. The only thing to do is make sure that there were no errors during the import operation.

Note 2:

Some ViewModels require different Web Api service scripts to be run.

Instructions:

  • Right click Controllers-folder of the Dm04WebApp.csproj-project
    • Open WebApiServices Wizard
  • On the first page
    • click Next-button

picture

  • On the second page
    • select aspnetchckdbcontext - context
    • click Next-button

picture

aspnetdashboardView

  • On the third page
    • select aspnetdashboardView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select DefaultWebApiService.cs.t4-script
    • click Next-button

picture

  • On the fifth page
    • click Save-button
    • click Next-button

picture

You are on the third page again

aspnetmodelView

  • On the third page
    • select aspnetmodelView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select DefaultWebApiService.cs.t4-script
    • click Next-button
  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again

aspnetrolemaskView

  • On the third page
    • select aspnetmodelView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select DefaultWebApiService.cs.t4-script
    • click Next-button
  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again

aspnetroleView

  • On the third page
    • select aspnetroleView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select WebApiAspNetRoleService.cs.t4-script
    • click Next-button

picture

  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again

aspnetuserView

  • On the third page
    • select aspnetuserView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select WebApiAspNetUserService.cs.t4-script
    • click Next-button

picture

  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again

aspnetusermaskView

  • On the third page
    • select aspnetusermaskView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select WebApiAspNetUserMasksService.cs.t4-script
    • click Next-button

picture

  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again

aspnetuserrolesView

  • On the third page
    • select aspnetuserrolesView
    • make sure checkboxes checked as it is shown on the slide below
    • click Next-button

picture

  • On the fourth page
    • select WebApiAspNetUserRoles.cs.t4-script
    • click Next-button

picture

  • On the fifth page
    • click Save-button
    • click Next-button

You are on the third page again