ASP.NET MVC C# VS 2019 Can you please help me with the syntax error? I was trying to display the calendar on the top of the page but I made an error.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

ASP.NET MVC C# VS 2019
Can you please help me with the syntax error? I was trying to display the calendar on the top of the page but I made an error.

@model List<AdventureDB.Models.CalendarItem>

@using System
@using System.Web.Mvc

@{
var weeks = (int)Math.Ceiling((double)(Model.Count + 13) / 7);
var startDate = Model.Count > 0 ? Model[0].Date : DateTime.Today;

var endDate = startDate.AddYears(4);
}

@using (Html.BeginForm("Index", "Home", FormMethod.Get))
{
<label for="startDate">Training Start Date:</label>
<input type="date" id="startDate" name="startDate" />
<input type="submit" value="Submit" />
}

@model IEnumerable<AdventureDB.Models.Training_Program>
@using AdventureDB.Models
@{
// Create an instance of the data context
var dbIEFW = new IEFWResourceDataContext();
var dbIFE = new IFEResourcesDataContext();
var dbREF = new REFDataContext();
var dbAQC = new AQCDataContext();
var dbAQCUSAF = new AQCUSAFDataContext();
var dbIPC = new IPCDataContext();
var dbIFTR = new IFTRDataContext();
var dbREFUSAF = new REFUSAFDataContext();
var dbIPCUSAF = new IPCUSAFResourcesDataContext();
int cntr = 0;
ViewBag.Title = "Index";
}

<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<style>
th {
color: white;
font-weight: bold;
font-style: normal;
font-family: "Times New Roman", Times, serif;
text-align: center;
}

td {
color: yellow;
font-weight: normal;
font-style: normal;
font-family: "Times New Roman", Times, serif;
text-align: center;
white-space: nowrap;
}

.calendar {
display: flex;
flex-direction: column;
width: max-content;
width: 620px;
}

.header {
display: flex;
justify-content: space-between;
background-color: lightgray;
padding: 5px;
}

.yellow-link {
color: yellow;
}

.horizontal-row-IEFW {
display: flex;
flex-direction: row;
color: blue;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-IFE {
display: flex;
flex-direction: row;
color: gainsboro;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-REF {
display: flex;
flex-direction: row;
color: aqua;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-REFUSAF {
display: flex;
flex-direction: row;
color: aquamarine;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-IFTR {
display: flex;
flex-direction: row;
color: beige;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-IPC {
display: flex;
flex-direction: row;
color: red;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-IPCUSAF {
display: flex;
flex-direction: row;
color: ActiveBorder;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row-AQCUSAF {
display: flex;
flex-direction: row;
color: blueviolet;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}


.horizontal-row-AQC {
display: flex;
flex-direction: row;
color: pink;
font-weight: bold;
font-size: 20px;
font-family: "Times New Roman", Times, serif;
}

.horizontal-row span {
margin-right: 10px;
}
</style>

</head>
<body>
<div id="calendar"></div>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<div class="body" style="background-image: url('/Images/bckgrnd.JPG'); background-size: cover; background-position: center; background-repeat: no-repeat;">
@for (var i = 0; i < weeks; i++)
{
var weekStartDate = startDate.AddDays(i * 7);
var weekEndDate = weekStartDate.AddDays(4);

<div class="week">
<div class="day">
<div class="date">@weekStartDate.ToString("MMM d, yyyy")</div>
</div>

@for (var j = 0; j < 5; j++)
{
var index = i * 5 + j;
var currentDate = weekStartDate.AddDays(j);

if (currentDate <= endDate)
{
var dayName = currentDate.ToString("ddd").Substring(0, 3);
<div class="day @(Model[index].Style)">
<div class="date @(Model[index].Style.Contains("start-date") ? "start-date" : (Model[index].Style.Contains("end-date") ? "end-date" : ""))">
@dayName<br />
@currentDate.ToString("dd")
</div>
</div>
}
else
{
<div class="day"></div>
}
}
</div>
}
</div>

▷ File Edit View Git Project Build Debug Test Analyze Tools
e-O 13 -
Debug. Any CPU
Index.cshtml X Index.cshtml
model List<AdventureDB.Models.CalendarItem>
@using System
@using System.Web.Mvc
@(
var weeks - (int)Math.Ceiling ((double) (Model.Count + 13) / 7);
var startDate Model.Count
? Model[0]. Date:
var endDate startDate.AddYears (4);
}
@using (Html.BeginForm ("Index", "Home", FormMethod.Get
(
}
}
@model IEnumerable<AdventureDB.Models. Training Program>
@using AdventureDB.Models
@c
B
B
<label for="startDate">Training Start Date:</label
<input type="date" id="startDate" name="startDate
<input type="submit" value="Submit" />
▼
// Create an instance of the data context
var dbIEFW = new IEFWResourceDataContext();
var dbIFE new IFEResourcesDataContext();
<!DOCTYPE html>
<html>
B<head>
var dbREF= new REFDataContext();
var dbAQC new AQCDataContext();
var dbAQCUSAF new AQCUSAFDataContext();
var dbIPC new IPCDataContext();
var dbIFTR= new IFTRDataContext();
var dbREFUSAF = new REFUSAFDataContext();
var dbIPCUSAF new IPCUSAFResourcesDataContext();
int cntr = 0;
ViewBag.Title = "Index";
<title>Index</title>
Extensions Window Help
-> IIS Express (Internet Explorer) C
-
<style>
th {
color: white;
font-weight: bold;
← →
07 41.
Web Publish Activity Error List Output
Rebuild All succeeded
Search (Ctrl+Q)
100%
Output
Show output from: Build
N
Rebuild started...
1> Rebuild All started: Project: AdventureDB, Configuration: Debug Any CPU ------
1> AdventureDB -> C:\Users\khanha\source\repos\AdventureDB\AdventureDB\bin\AdventureDB.dll
========== Rebuild All: 1 succeeded, 0 failed, e skipped ==========
▾
Returns:
The number of elements in the input sequence.
Exceptions:
Q
a
M
(extension) int IEnumerable< Training Program>.Count<Training Program>() (+ 1 overload)
Returns the number of elements in a sequence.
P AdventureDB
***=
ArgumentNullException
OverflowException
CS0019: Operator + cannot be applied to operands of type 'method group' and 'int'
Search Solution Explorer (Ctrl+:)
>> Properties
References
Solution Explorer
COO-20-
>
D
D c" FilterConfig.cs
RouteConfig.cs
D
▷c c*
> Content
Þ
D
App Data
App Start
c" BundleConfig.cs
D
D
D
D
D
HK
Controllers
C= HomeController.cs
C* SchedulingController.cs
fonts
Images
bckgrnd.JPG
Models.
AQCDataModel.edmx
AQCUSAFDataModel.edmx
C CalendarModel.cs
Properties
Live Share
a X
D
D
▷ REFResourcesDataModel.edmx
▷REFUSAFDataModel.edmx
4 Home
IEFWResourceDataModel.edmx
IFEResourcesDataModel.edmx
DIFTRResourceDataModel.edmx
IPCResourcesDataModel.edmx
IPCUSAFResourcesDataModel.edmx
>Scheduling DataModel.edmx
Scripts
Views
[@] About.cshtml
[@Blank.cshtml
[@Contact.cshtml
[Index.cshtml
Report
A Scheduling
[@]Create.cshtml
@Delete.cshtml
-x
P.
↑ Add to Source Control 4₁
Transcribed Image Text:▷ File Edit View Git Project Build Debug Test Analyze Tools e-O 13 - Debug. Any CPU Index.cshtml X Index.cshtml model List<AdventureDB.Models.CalendarItem> @using System @using System.Web.Mvc @( var weeks - (int)Math.Ceiling ((double) (Model.Count + 13) / 7); var startDate Model.Count ? Model[0]. Date: var endDate startDate.AddYears (4); } @using (Html.BeginForm ("Index", "Home", FormMethod.Get ( } } @model IEnumerable<AdventureDB.Models. Training Program> @using AdventureDB.Models @c B B <label for="startDate">Training Start Date:</label <input type="date" id="startDate" name="startDate <input type="submit" value="Submit" /> ▼ // Create an instance of the data context var dbIEFW = new IEFWResourceDataContext(); var dbIFE new IFEResourcesDataContext(); <!DOCTYPE html> <html> B<head> var dbREF= new REFDataContext(); var dbAQC new AQCDataContext(); var dbAQCUSAF new AQCUSAFDataContext(); var dbIPC new IPCDataContext(); var dbIFTR= new IFTRDataContext(); var dbREFUSAF = new REFUSAFDataContext(); var dbIPCUSAF new IPCUSAFResourcesDataContext(); int cntr = 0; ViewBag.Title = "Index"; <title>Index</title> Extensions Window Help -> IIS Express (Internet Explorer) C - <style> th { color: white; font-weight: bold; ← → 07 41. Web Publish Activity Error List Output Rebuild All succeeded Search (Ctrl+Q) 100% Output Show output from: Build N Rebuild started... 1> Rebuild All started: Project: AdventureDB, Configuration: Debug Any CPU ------ 1> AdventureDB -> C:\Users\khanha\source\repos\AdventureDB\AdventureDB\bin\AdventureDB.dll ========== Rebuild All: 1 succeeded, 0 failed, e skipped ========== ▾ Returns: The number of elements in the input sequence. Exceptions: Q a M (extension) int IEnumerable< Training Program>.Count<Training Program>() (+ 1 overload) Returns the number of elements in a sequence. P AdventureDB ***= ArgumentNullException OverflowException CS0019: Operator + cannot be applied to operands of type 'method group' and 'int' Search Solution Explorer (Ctrl+:) >> Properties References Solution Explorer COO-20- > D D c" FilterConfig.cs RouteConfig.cs D ▷c c* > Content Þ D App Data App Start c" BundleConfig.cs D D D D D HK Controllers C= HomeController.cs C* SchedulingController.cs fonts Images bckgrnd.JPG Models. AQCDataModel.edmx AQCUSAFDataModel.edmx C CalendarModel.cs Properties Live Share a X D D ▷ REFResourcesDataModel.edmx ▷REFUSAFDataModel.edmx 4 Home IEFWResourceDataModel.edmx IFEResourcesDataModel.edmx DIFTRResourceDataModel.edmx IPCResourcesDataModel.edmx IPCUSAFResourcesDataModel.edmx >Scheduling DataModel.edmx Scripts Views [@] About.cshtml [@Blank.cshtml [@Contact.cshtml [Index.cshtml Report A Scheduling [@]Create.cshtml @Delete.cshtml -x P. ↑ Add to Source Control 4₁
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY