Run(
23 | [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
24 | ILogger log)
25 | {
26 | log.LogInformation("C# HTTP trigger function processed a request.");
27 |
28 | string text = req.Query["text"];
29 |
30 | string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
31 | dynamic data = JsonConvert.DeserializeObject(requestBody);
32 | text = text ?? data?.text;
33 |
34 |
35 | var result = sentimentAnaysisService.GetSentiment(text);
36 |
37 | return new OkObjectResult(result);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Chapter06/cli scripts/sql migration scripts.txt:
--------------------------------------------------------------------------------
1 | # Getting the list of available locations
2 | az account list-locations -o table
3 |
4 |
5 | # Creating a resource group
6 | resourceGroupName=bookAppResourceGroup
7 | location=australiaeast
8 | az group create --name $resourceGroupName --location $location
9 |
10 |
11 | # Creating SQL Server in Azure
12 | adminlogin=sqlserveradmin
13 | password=ASampleP@ssw0rd!
14 | serverName=BookAppSQLServer2020
15 |
16 | az sql server create \
17 | --name $serverName \
18 | --resource-group $resourceGroupName \
19 | --location $location \
20 | --admin-user $adminlogin \
21 | --admin-password $password
22 |
23 |
24 | #Whitelisting IP Addresses
25 | startip=118.211.162.81
26 | endip=118.211.162.81
27 | az sql server firewall-rule create \
28 | --resource-group $resourceGroupName \
29 | --server $serverName \
30 | -n DeveloperLocalIP \
31 | --start-ip-address $startip \
32 | --end-ip-address $endip
33 | az sql server firewall-rule create \
34 | --resource-group $resourceGroupName \
35 | --server $serverName \
36 | -n AzureServices \
37 | --start-ip-address 0.0.0.0 \
38 | --end-ip-address 0.0.0.0
39 |
40 |
41 | # Creating SQL database
42 | az sql db create \
43 | --resource-group $resourceGroupName \
44 | --server $serverName \
45 | --name BookApp \
46 | --service-objective Basic
47 |
48 | # Querying the database
49 | SELECT TOP 10 * FROM [Book]
50 | Inner Join BookReview
51 | ON Book.Id = BookReview.Book_Id
52 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/BookApp.Web/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("BookApp.Web")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BookApp.Web")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("c75b0c42-ab66-4a4b-a991-265536dc8ca9")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/Chapter04/microservicesapp/rabbitmq.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: rabbitmq
5 | labels:
6 | app.kubernetes.io/name: rabbitmq
7 | app.kubernetes.io/part-of: microservicesapp
8 | spec:
9 | selector:
10 | matchLabels:
11 | app.kubernetes.io/name: rabbitmq
12 | replicas: 1
13 | template:
14 | metadata:
15 | labels:
16 | app.kubernetes.io/name: rabbitmq
17 | app.kubernetes.io/part-of: microservicesapp
18 | spec:
19 | containers:
20 | - name: rabbitmq
21 | image: rabbitmq:3-management
22 | resources:
23 | requests:
24 | cpu: 100m
25 | memory: 100Mi
26 | ports:
27 | - containerPort: 5672
28 | - containerPort: 15672
29 |
30 | ---
31 | apiVersion: v1
32 | kind: Service
33 | metadata:
34 | name: rabbitmq
35 | labels:
36 | app.kubernetes.io/name: rabbitmq
37 | app.kubernetes.io/part-of: microservicesapp
38 | spec:
39 | ports:
40 | - port: 5672
41 | protocol: TCP
42 | targetPort: 5672
43 | selector:
44 | app.kubernetes.io/name: rabbitmq
45 | ---
46 | apiVersion: v1
47 | kind: Service
48 | metadata:
49 | name: rabbitmq-mui
50 | labels:
51 | app.kubernetes.io/name: rabbitmq
52 | app.kubernetes.io/part-of: microservicesapp
53 | spec:
54 | type: NodePort
55 | ports:
56 | - port: 15672
57 | protocol: TCP
58 | targetPort: 15672
59 | nodePort: 30072
60 | selector:
61 | app.kubernetes.io/name: rabbitmq
62 |
--------------------------------------------------------------------------------
/Chapter05/net5/BookApp/BookApp.Web.V2/Views/Books/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model BookApp.Models.Book
2 |
3 | @{
4 | ViewBag.Title = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Book
11 |
12 |
13 | -
14 | @Html.DisplayNameFor(model => model.Title)
15 |
16 |
17 | -
18 | @Html.DisplayFor(model => model.Title)
19 |
20 |
21 | -
22 | @Html.DisplayNameFor(model => model.SubTitle)
23 |
24 |
25 | -
26 | @Html.DisplayFor(model => model.SubTitle)
27 |
28 |
29 | -
30 | @Html.DisplayNameFor(model => model.DatePublished)
31 |
32 |
33 | -
34 | Date Published
35 |
36 |
37 | -
38 | Cover Image
39 |
40 |
41 | -
42 | @if (Model.CoverImage != null)
43 | {
44 |
45 | }
46 |
47 |
48 |
49 | -
50 | @Html.DisplayNameFor(model => model.Author)
51 |
52 |
53 | -
54 | @Html.DisplayFor(model => model.Author)
55 |
56 |
57 |
58 |
59 |
60 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = Model.Id }, null) |
61 | @Html.ActionLink("Back to List", "Index")
62 |
63 |
--------------------------------------------------------------------------------
/Chapter06/azure/BookApp/BookApp.Web.V2/Properties/PublishProfiles/bookApp2020 - Web Deploy.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | MSDeploy
9 | AzureWebSite
10 | Release
11 | Any CPU
12 | http://bookapp2020.azurewebsites.net
13 | True
14 | False
15 | 2c2181b3-a12d-4d27-826c-4dc9f63b7415
16 | bookapp2020.scm.azurewebsites.net:443
17 | bookApp2020
18 |
19 | True
20 | WMSVC
21 | True
22 | $bookApp2020
23 | <_SavePWD>True
24 | <_DestinationType>AzureWebSite
25 |
26 |
--------------------------------------------------------------------------------
/Chapter06/azure/BookApp/BookApp.Web.V2/Views/Books/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model BookApp.Models.Book
2 |
3 | @{
4 | ViewBag.Title = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Book
11 |
12 |
13 | -
14 | @Html.DisplayNameFor(model => model.Title)
15 |
16 |
17 | -
18 | @Html.DisplayFor(model => model.Title)
19 |
20 |
21 | -
22 | @Html.DisplayNameFor(model => model.SubTitle)
23 |
24 |
25 | -
26 | @Html.DisplayFor(model => model.SubTitle)
27 |
28 |
29 | -
30 | @Html.DisplayNameFor(model => model.DatePublished)
31 |
32 |
33 | -
34 | Date Published
35 |
36 |
37 | -
38 | Cover Image
39 |
40 |
41 | -
42 | @if (Model.CoverImage != null)
43 | {
44 |
45 | }
46 |
47 |
48 |
49 | -
50 | @Html.DisplayNameFor(model => model.Author)
51 |
52 |
53 | -
54 | @Html.DisplayFor(model => model.Author)
55 |
56 |
57 |
58 |
59 |
60 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = Model.Id }, null) |
61 | @Html.ActionLink("Back to List", "Index")
62 |
63 |
--------------------------------------------------------------------------------
/Chapter06/onprem/BookApp/BookApp.Web.V2/Views/Books/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model BookApp.Models.Book
2 |
3 | @{
4 | ViewBag.Title = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Book
11 |
12 |
13 | -
14 | @Html.DisplayNameFor(model => model.Title)
15 |
16 |
17 | -
18 | @Html.DisplayFor(model => model.Title)
19 |
20 |
21 | -
22 | @Html.DisplayNameFor(model => model.SubTitle)
23 |
24 |
25 | -
26 | @Html.DisplayFor(model => model.SubTitle)
27 |
28 |
29 | -
30 | @Html.DisplayNameFor(model => model.DatePublished)
31 |
32 |
33 | -
34 | Date Published
35 |
36 |
37 | -
38 | Cover Image
39 |
40 |
41 | -
42 | @if (Model.CoverImage != null)
43 | {
44 |
45 | }
46 |
47 |
48 |
49 | -
50 | @Html.DisplayNameFor(model => model.Author)
51 |
52 |
53 | -
54 | @Html.DisplayFor(model => model.Author)
55 |
56 |
57 |
58 |
59 |
60 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = Model.Id }, null) |
61 | @Html.ActionLink("Back to List", "Index")
62 |
63 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/BookApp.Web/Views/Books/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model BookApp.Models.Book
2 |
3 | @{
4 | ViewBag.Title = "Details";
5 | }
6 |
7 | Details
8 |
9 |
10 |
Book
11 |
12 |
13 | -
14 | @Html.DisplayNameFor(model => model.Title)
15 |
16 |
17 | -
18 | @Html.DisplayFor(model => model.Title)
19 |
20 |
21 | -
22 | @Html.DisplayNameFor(model => model.SubTitle)
23 |
24 |
25 | -
26 | @Html.DisplayFor(model => model.SubTitle)
27 |
28 |
29 | -
30 | @Html.DisplayNameFor(model => model.DatePublished)
31 |
32 |
33 | -
34 | Date Published
35 |
36 |
37 | -
38 | Cover Image
39 |
40 |
41 | -
42 | @if (Model.CoverImage != null)
43 | {
44 |
45 | }
46 |
47 |
48 |
49 | -
50 | @Html.DisplayNameFor(model => model.Author)
51 |
52 |
53 | -
54 | @Html.DisplayFor(model => model.Author)
55 |
56 |
57 |
58 |
59 |
60 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = Model.Id }, null) |
61 | @Html.ActionLink("Back to List", "Index")
62 |
63 |
--------------------------------------------------------------------------------
/Chapter06/azure/BookApp/BookApp.Web.V2/BookApp.Web.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | 5e7819b3-da31-4d5b-8ba9-b100eeed7713
6 |
7 |
8 |
9 | false
10 | ..\docker-compose.dcproj
11 | Linux
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | true
26 | PreserveNewest
27 |
28 |
29 | true
30 | PreserveNewest
31 |
32 |
33 | true
34 | PreserveNewest
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/Models/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("BookApp.Models")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Models")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("c873adba-e37d-4844-8053-0141ce91ffc4")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Chapter05/net5/BookApp/AdminDesktop/ImageConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Data;
9 | using System.Windows.Media.Imaging;
10 |
11 | namespace AdminDesktop
12 | {
13 | public class ImageConverter:IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value != null)
18 | {
19 | byte[] byteArray = (byte[])value;
20 |
21 | if (byteArray == null)
22 | return null;
23 | BitmapImage image = new BitmapImage();
24 | using (MemoryStream imageStream = new MemoryStream())
25 | {
26 | imageStream.Write(byteArray, 0, byteArray.Length);
27 | imageStream.Seek(0, SeekOrigin.Begin);
28 | image.BeginInit();
29 | image.CacheOption = BitmapCacheOption.OnLoad;
30 | image.StreamSource = imageStream;
31 | image.EndInit();
32 | image.Freeze();
33 | }
34 | return image;
35 | }
36 | return null;
37 | }
38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
39 | {
40 | throw new NotImplementedException();
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/BookApp.DAL/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("BookApp.DAL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BookApp.DAL")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fd3755fa-b71d-43ac-aa15-f7126d676ddb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Chapter06/azure/BookApp/AdminDesktop/ImageConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Data;
9 | using System.Windows.Media.Imaging;
10 |
11 | namespace AdminDesktop
12 | {
13 | public class ImageConverter:IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value != null)
18 | {
19 | byte[] byteArray = (byte[])value;
20 |
21 | if (byteArray == null)
22 | return null;
23 | BitmapImage image = new BitmapImage();
24 | using (MemoryStream imageStream = new MemoryStream())
25 | {
26 | imageStream.Write(byteArray, 0, byteArray.Length);
27 | imageStream.Seek(0, SeekOrigin.Begin);
28 | image.BeginInit();
29 | image.CacheOption = BitmapCacheOption.OnLoad;
30 | image.StreamSource = imageStream;
31 | image.EndInit();
32 | image.Freeze();
33 | }
34 | return image;
35 | }
36 | return null;
37 | }
38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
39 | {
40 | throw new NotImplementedException();
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter06/onprem/BookApp/AdminDesktop/ImageConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Data;
9 | using System.Windows.Media.Imaging;
10 |
11 | namespace AdminDesktop
12 | {
13 | public class ImageConverter:IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value != null)
18 | {
19 | byte[] byteArray = (byte[])value;
20 |
21 | if (byteArray == null)
22 | return null;
23 | BitmapImage image = new BitmapImage();
24 | using (MemoryStream imageStream = new MemoryStream())
25 | {
26 | imageStream.Write(byteArray, 0, byteArray.Length);
27 | imageStream.Seek(0, SeekOrigin.Begin);
28 | image.BeginInit();
29 | image.CacheOption = BitmapCacheOption.OnLoad;
30 | image.StreamSource = imageStream;
31 | image.EndInit();
32 | image.Freeze();
33 | }
34 | return image;
35 | }
36 | return null;
37 | }
38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
39 | {
40 | throw new NotImplementedException();
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/AdminDesktop/ImageConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Data;
9 | using System.Windows.Media.Imaging;
10 |
11 | namespace AdminDesktop
12 | {
13 | public class ImageConverter:IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value != null)
18 | {
19 | byte[] byteArray = (byte[])value;
20 |
21 | if (byteArray == null)
22 | return null;
23 | BitmapImage image = new BitmapImage();
24 | using (MemoryStream imageStream = new MemoryStream())
25 | {
26 | imageStream.Write(byteArray, 0, byteArray.Length);
27 | imageStream.Seek(0, SeekOrigin.Begin);
28 | image.BeginInit();
29 | image.CacheOption = BitmapCacheOption.OnLoad;
30 | image.StreamSource = imageStream;
31 | image.EndInit();
32 | image.Freeze();
33 | }
34 | return image;
35 | }
36 | return null;
37 | }
38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
39 | {
40 | throw new NotImplementedException();
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Chapter07/SpendScorePredictor/SpendScorePredictorML.Model/ConsumeModel.cs:
--------------------------------------------------------------------------------
1 | // This file was auto-generated by ML.NET Model Builder.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using Microsoft.ML;
8 | using SpendScorePredictorML.Model;
9 |
10 | namespace SpendScorePredictorML.Model
11 | {
12 | public class ConsumeModel
13 | {
14 | private static Lazy> PredictionEngine = new Lazy>(CreatePredictionEngine);
15 |
16 | // For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
17 | // Method for consuming model in your app
18 | public static ModelOutput Predict(ModelInput input)
19 | {
20 | ModelOutput result = PredictionEngine.Value.Predict(input);
21 | return result;
22 | }
23 |
24 | public static PredictionEngine CreatePredictionEngine()
25 | {
26 | // Create new MLContext
27 | MLContext mlContext = new MLContext();
28 |
29 | // Load model & create prediction engine
30 | string modelPath = @"C:\Users\Default\AppData\Local\Temp\MLVSTools\SpendScorePredictorML\SpendScorePredictorML.Model\MLModel.zip";
31 | ITransformer mlModel = mlContext.Model.Load(modelPath, out var modelInputSchema);
32 | var predEngine = mlContext.Model.CreatePredictionEngine(mlModel);
33 |
34 | return predEngine;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Chapter05/net5/BookApp/BookApp.Web.V2/Views/Books/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewBag.Title = "Books List";
5 | }
6 |
7 | Books List
8 |
9 |
10 |
11 | |
12 | @Html.DisplayNameFor(model => model.Title)
13 | |
14 |
15 | @Html.DisplayNameFor(model => model.SubTitle)
16 | |
17 |
18 | Date Published
19 | |
20 |
21 | Cover Image
22 | |
23 |
24 | @Html.DisplayNameFor(model => model.Author)
25 | |
26 | |
27 |
28 |
29 | @foreach (var item in Model) {
30 |
31 | |
32 | @Html.DisplayFor(modelItem => item.Title)
33 | |
34 |
35 | @Html.DisplayFor(modelItem => item.SubTitle)
36 | |
37 |
38 | @item.DatePublished.ToString("d")
39 | |
40 |
41 | @if (item.CoverImage != null)
42 | {
43 |
44 | }
45 | |
46 |
47 | @Html.DisplayFor(modelItem => item.Author)
48 | |
49 |
50 | @Html.ActionLink("Details", "Details", new { id = item.Id }) |
51 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = item.Id },null)
52 | |
53 |
54 | }
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Chapter06/azure/BookApp/BookApp.Web.V2/Views/Books/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewBag.Title = "Books List";
5 | }
6 |
7 | Books List
8 |
9 |
10 |
11 | |
12 | @Html.DisplayNameFor(model => model.Title)
13 | |
14 |
15 | @Html.DisplayNameFor(model => model.SubTitle)
16 | |
17 |
18 | Date Published
19 | |
20 |
21 | Cover Image
22 | |
23 |
24 | @Html.DisplayNameFor(model => model.Author)
25 | |
26 | |
27 |
28 |
29 | @foreach (var item in Model) {
30 |
31 | |
32 | @Html.DisplayFor(modelItem => item.Title)
33 | |
34 |
35 | @Html.DisplayFor(modelItem => item.SubTitle)
36 | |
37 |
38 | @item.DatePublished.ToString("d")
39 | |
40 |
41 | @if (item.CoverImage != null)
42 | {
43 |
44 | }
45 | |
46 |
47 | @Html.DisplayFor(modelItem => item.Author)
48 | |
49 |
50 | @Html.ActionLink("Details", "Details", new { id = item.Id }) |
51 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = item.Id },null)
52 | |
53 |
54 | }
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Chapter06/onprem/BookApp/BookApp.Web.V2/Views/Books/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewBag.Title = "Books List";
5 | }
6 |
7 | Books List
8 |
9 |
10 |
11 | |
12 | @Html.DisplayNameFor(model => model.Title)
13 | |
14 |
15 | @Html.DisplayNameFor(model => model.SubTitle)
16 | |
17 |
18 | Date Published
19 | |
20 |
21 | Cover Image
22 | |
23 |
24 | @Html.DisplayNameFor(model => model.Author)
25 | |
26 | |
27 |
28 |
29 | @foreach (var item in Model) {
30 |
31 | |
32 | @Html.DisplayFor(modelItem => item.Title)
33 | |
34 |
35 | @Html.DisplayFor(modelItem => item.SubTitle)
36 | |
37 |
38 | @item.DatePublished.ToString("d")
39 | |
40 |
41 | @if (item.CoverImage != null)
42 | {
43 |
44 | }
45 | |
46 |
47 | @Html.DisplayFor(modelItem => item.Author)
48 | |
49 |
50 | @Html.ActionLink("Details", "Details", new { id = item.Id }) |
51 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = item.Id },null)
52 | |
53 |
54 | }
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Chapter05/netframework472/BookApp/BookApp.Web/Views/Books/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewBag.Title = "Books List";
5 | }
6 |
7 | Books List
8 |
9 |
10 |
11 | |
12 | @Html.DisplayNameFor(model => model.Title)
13 | |
14 |
15 | @Html.DisplayNameFor(model => model.SubTitle)
16 | |
17 |
18 | Date Published
19 | |
20 |
21 | Cover Image
22 | |
23 |
24 | @Html.DisplayNameFor(model => model.Author)
25 | |
26 | |
27 |
28 |
29 | @foreach (var item in Model) {
30 |
31 | |
32 | @Html.DisplayFor(modelItem => item.Title)
33 | |
34 |
35 | @Html.DisplayFor(modelItem => item.SubTitle)
36 | |
37 |
38 | @item.DatePublished.ToString("d")
39 | |
40 |
41 | @if (item.CoverImage != null)
42 | {
43 |
44 | }
45 | |
46 |
47 | @Html.DisplayFor(modelItem => item.Author)
48 | |
49 |
50 | @Html.ActionLink("Details", "Details", new { id = item.Id }) |
51 | @Html.ActionLink("Reviews", "Index", "BookReviews", new { id = item.Id },null)
52 | |
53 |
54 | }
55 |
56 |
57 |
--------------------------------------------------------------------------------