Platformslatforms ASP MVC 5 - Cleveland State University

Transcription

Rosly Course Registration SystemSoftware Code walk Through by Derrick AwuahPlatformsASP.NET MVC 5Web application framework developed by Microsoft. It is best to develop ASP.NET websites by usingVisual Studio which you can get here.https://www.visualstudio.com/downloads/Entity Framework 6Entity Framework is an object-relational mapping framework for ADO.NET. It creates classes of yourtables in the database and maps it to the table in the database.Setup:1. Click on Tools - NuGet Package Manager - Package Manager Console

2. In the console enter the command ‘install-package EntityFramework’To connect to SQL Server:Web.config in the project is configured as: provider System.Data.EntityClient; andprovider System.Data.SqlClient which is the .NET Framework Data Provider for SQL Server. This usesADO.NET but it allows for a higher level of abstraction.The MSDN docs are at 28v vs.110%29.aspxand 28v vs.110%29.aspxAJAXAjax allows you to create client-side scripts in javascript that will allow you to communicate with thedatabase without refreshing the page. This is used on all of our webpages where you make some kind ofcall to the database and the page is not refreshed, such as on the dashboard page.Example:The following code will make a call to the GetEnrollments() function in the Dashboard controller andpass in the value of data as a parameter. Then it will take the html returned from the controller and loadit where the enrollmentDash id is found.var getEnrollments function (data) { .ajax({url: '@Url.Content( " /Dashboard/GetEnrollments")',type: "POST",dataType: 'html',

contentType: 'application/json',data: data,success: function (result) {//alert(result); ("#enrollmentDash").html(result);},fail: function () {alert("Failed");}});};LinqWe use Linq to query data in the database instead of using stored procedures or hand writing our SQLqueries. We have this ability because of the mapping of the tables to classes in Entity Framework. Linq ispart of the syntax in C# so no additional setup is needed to use Linq. All of our queries to the databaseare done in the repositories part of our application. To use link you must put add the using statement‘using System.Linq;’ to your file.Example:The following query will select all of the enrollments where the area of the course contains the value indto.Area.return db.Enrollments.Where(s s.Schedule.area.Contains(dto.Area)).ToList();

ExamplesRetrievalGet Upcoming CoursesNavigation to: You land on the page that displays upcoming courses upon page load or byselecting Course List in the nav bar.When the url /Courses/Index is called you make a call to the index method in the coursescontroller ( \Controllers\CoursesControler.cs ):Using statements: using Rosly.Models is for the Models folder of the project using Rosly.ViewModels is for the ViewModels folder of the project using Rosly.Repositories is for the Repositories folder of the project using System.Linq is so Linq can be used in the file using System.Net is used to return specific status codes for errors in ;Rosly.Repositories;namespace Rosly.Controllers{public class CoursesController : Controller{private readonly RoslyDbEntities db;private readonly InstructorRepository instructorRepository;private readonly LocationRepository locationRepository;private readonly CourseRepository courseRepository;private readonly ScheduleRepository scheduleRepository;public CoursesController(){db new RoslyDbEntities();instructorRepository new InstructorRepository( db);courseRepository new CourseRepository( db);locationRepository new LocationRepository( db);scheduleRepository new ScheduleRepository( db);}

// GET: Coursespublic ActionResult Index(){//var sixMonthsAgo DateTime.Now.AddMonths(-6);var user User.Identity.IsAuthenticated;var viewModel new CoursesViewModel(){UpcomingCourses ocations ions user};return View(viewModel);}// Get: Courses/Createpublic ActionResult Create(){var areas locationRepository.GetLocations();var instructors instructorRepository.GetInstructors();//var course db.Courses.SingleOrDefault(c c.id id);var courses courseRepository.GetCourses();var viewModel new CourseFormViewModel(){};return View("CourseForm", viewModel);}// Post: tiForgeryToken]public ActionResult Create(CourseFormViewModel viewModel){if (!ModelState.IsValid){return View("CourseForm", viewModel);}var course new Course(){description viewModel.Description,course id Changes();return RedirectToAction("Index", "Courses");}public ActionResult Edit(int id){

var course courseRepository.GetCourse(id);if (course null){return HttpNotFound();}var viewModel new CourseFormViewModel(){Id id,CourseId course.course id,Description course.description};return View("CourseForm", ForgeryToken]public ActionResult Update(CourseFormViewModel viewModel){if (!ModelState.IsValid){return View("CourseForm", viewModel);}var course courseRepository.GetCourse(viewModel.Id);if (course null){return HttpNotFound();}course.description viewModel.Description;course.course id viewModel.CourseId;db.SaveChanges();return RedirectToAction("Index", "Courses");}// Get: Courses/Details/5public ActionResult Details(int? id){if (id null){return new ar course courseRepository.GetCourse((int)id);if (course null){return HttpNotFound();}var viewModel new CourseDetailsViewModel(){//EnrolledEmployees students,

CourseSchedule rse),Id course.id,Description course.description,Name course.course id};return View(viewModel);}public ActionResult SelectCourse(){var courses courseRepository.GetCourses();var viewModel new CourseListViewModel(){Courses courses};return View("List", viewModel);}}}The controller first checks to see if the user is logged in or not and will set the user variable toeither true or false. Then it will create a new object of type CoursesViewModel with theproperties UpcomingCourses and ShowActions. UpcomingCourses is the list of upcomingcourses that are scheduled, and ShowActions is set to the user variable determines whether ornot the user is displayed additional actions such as editing a course. The list of courses(UpcomingCourses) is loaded by making a call to the database by using theGetUpcomingCourses() method in the y.cs) els;namespace Rosly.Repositories{public class ScheduleRepository{private readonly RoslyDbEntities db;public ScheduleRepository(){}

public ScheduleRepository(RoslyDbEntities db){db db;}public IEnumerable Schedule GetUpcomingCourses(){return db.Schedules.Where(c c.start date DateTime.Now && c.is canceled ! true).OrderBy(c c.start date).Include(c c.Location);}public Schedule Find(int? id){return db.Schedules.Find(id);}public IEnumerable Schedule GetUpcomingScheduleByCourse(Course course){return course.Schedules.ToList();}public Schedule GetScheduledCourse(int id){return db.Schedules.Single(c c.id id);}}}The GetUpcomingCourses() method queries the database for courses on the schedule that arenot cancelled and have a start date that is after the current time. The courses are then orderedby their start date then the list of upcoming courses is returned to the Index method.Now that view model object is created it is passed to the Courses\Index.cshtml view:@model Rosly.ViewModels.CoursesViewModel@{ViewBag.Title "Index";Layout " /Views/Shared/ Layout.cshtml";} style fo:visited,.btn-info:focus {

background-color: #808285;border-color: ary:active,.btn-primary:visited,.btn-primary:focus {background-color: #bb2322;border-color: #bb2322;}body {padding-top: 55px;}table {text-align: left;}.th {padding: 10px;}.custab {border: 3px solid #808285;padding: 5px;margin: 5% 0;box-shadow: 3px 3px 0px #bb2322;transition: 0.5s;}.custab:hover {box-shadow: 3px 3px 3px transparent;transition: 0.5s;}.container {max-width: 50000000px;} /style div class "dashhead" div class "dashhead-titles" h6 class "dashhead-subtitle" Rosly /h6 h2 class "dashhead-title" Schedule /h2 /div div class "btn-toolbar dashhead-toolbar" /div /div hr class "m-t" div class "custyle" @if (Model.ShowActions){ a href "@Url.Action("Create", "Schedule")" class "btn btn-primary btn-xspull-left" b /b Create a new class /a }

table class "table table-striped custab" thead tr class "tableformat" th Course Name /th th Location /th th Start Time /th th Capacity /th th Actions /th /tr /thead @foreach (var course in Model.UpcomingCourses){ tr td @Html.DisplayFor(model course.Course.course id) /td td @Html.DisplayFor(model course.area) /td td @Html.DisplayFor(model course.start date) /td td @course.Enrollments.Count / @course.max capacity /td td style "text-align: center" a class 'btn btn-primary btn-xs'href "@Url.Action("Details","Schedule",new { id course.id })" Enroll /a @if (Model.ShowActions){ a class 'btn btn-info btn-xs'href "@Url.Action("Edit","Schedule",new { id course.id })" Edit /a } /tr } /table /div

The model type is specified by the @model Rosly.ViewModels.CoursesViewModel. Then aforeach loop is created to load an object for each course in the Model.UpcomingCourses (this isthe UpcomingCourses property in the view model) and display the relevant information foreach of the courses. The @if (Model.ShowActions) checks to see if the ShowActions attribute istrue and if it is, the edit button will also be displayed for each of the courses.InsertAdd Course to ScheduleCourses are added to the schedule from the add a course to schedule page which uses theScheduleForm view: \Views\Shared\ScheduleFrom.cshmtl@model tle "ScheduleForm";Layout " /Views/Shared/ Layout.cshtml";}@* h2 @Model.Course.course id /h2 *@ h2 Schedule Form /h2 @using (Html.BeginForm(Model.Action, ionSummary(true, "", new { @class "text-danger" })@* div class "form-group" @Html.HiddenFor(model model.Course)@Html.HiddenFor(model model.Course.course id) /div *@ div class "form-group" @*@Html.LabelFor(model model.Id, "Course Name")*@@* div class "col-md-10" *@@Html.EditorFor(model model.Id, new { htmlAttributes new { @class "formcontrol hide" } })@Html.ValidationMessageFor(model model.Id, "", new { @class "text-dangerhide" })@* /div *@ /div div class "form-group" @Html.LabelFor(model model.Course)@Html.DropDownListFor(m m.Course, new SelectList(Model.Courses, "id","course id"), "", new { @class "form-control" })@Html.ValidationMessageFor(model model.Course, "", new { @class "textdanger" }) /div

div class "form-group" @Html.LabelFor(model model.StartDate, "Start Date")@* div class "col-md-10" *@@Html.TextBoxFor(model model.StartDate, new { @class "form-control",placeholder "1 Jan 2017" })@Html.ValidationMessageFor(model model.StartDate, "", new { @class "textdanger" })@* /div *@ /div div class "form-group" @Html.LabelFor(model model.StartTime, "Start Time")@* div class "col-md-10" *@@Html.EditorFor(model model.StartTime, new { htmlAttributes new { @class "form-control" } })@Html.ValidationMessageFor(model model.StartTime, "", new { @class "textdanger" })@* /div *@ /div div class "form-group" @Html.LabelFor(model model.Instructor)@Html.DropDownListFor(m m.Instructor, new SelectList(Model.Instructors,"email", "email"), "", new { @class "form-control" })@Html.ValidationMessageFor(m m.Instructor, "", new { @class "text-danger" }) /div div class "form-group" @Html.LabelFor(model model.Area)@* div class "col-md-10" *@@Html.DropDownListFor(m m.Area, new SelectList(Model.Areas, "area", "area"),"", new { @class "form-control" })@Html.ValidationMessageFor(m m.Area, "", new { @class "text-danger" })@* /div *@ /div div class "form-group" @Html.LabelFor(model model.MaxCapacity, "Max Capacity")@* div class "col-md-10" *@@Html.EditorFor(model model.MaxCapacity, new { htmlAttributes new {@class "form-control" } })@Html.ValidationMessageFor(model model.MaxCapacity, "", new { @class "text-danger" })@* /div *@ /div @* div class "form-group" div class "col-md-offset-2 col-md-10" input type "submit" value "Create" class "btn btn-default" / /div /div *@ button type "submit" class "btn btn-primary" onclick "alerttest()" Save /button @* /div *@} div @Html.ActionLink("Back to List", "Index", "Courses")

/div @section scripts{@Scripts.Render(" /bundles/jqueryval")}The schedule form view uses the ScheduleFormViewModel. The form uses each field to createthe value of the given property in the \ViewModels\ScheduleFormViewModel.cshtml :Using Statements tModel.DataAnnotations allows the ability to create restrictions foreach property such as making it required or to set the max length of a stringRosly.Models is the folder containing the models for the projectRosly.Controllers is the folder containing the controllers for the amespace Rosly.ViewModels{public class ScheduleFormViewModel{public int Id { get; set; }//[Required]//[MaxLength(10)]//public string CourseId { get; set; }[Required]public int Course { get; set; }//public Course Course { get; set; }public IEnumerable Course Courses { get; set; }[Required]public string StartDate { get; set; }[Required]public string StartTime { get; set; }public string EndDate { get; set; }[Required]public string Area { get; set; }public IEnumerable Location Areas { get; set; }[Required]public int MaxCapacity { get; set; }

[Required]public string Instructor { get; set; }public IEnumerable Instructor Instructors { get; set; }public string Action{get{Expression Func ScheduleController, ActionResult update (c c.Update(this));Expression Func ScheduleController, ActionResult create (c c.Create(this));var action (Id ! 0) ? update : create;return (action.Body as MethodCallExpression).Method.Name;}}public DateTime GetDateTime(){return DateTime.Parse(string.Format("{0} {1}", StartDate, StartTime));}}}The Action method in the view model checks to see what method called the view model so theappropriate fields can be displayed in the view. When the form is submitted it calls the createmethod in the schedule controller : ViewModels;namespace Rosly.Controllers{public class ScheduleController : Controller{private readonly RoslyDbEntities db;private readonly LocationRepository locationRepository;private readonly ScheduleRepository scheduleRepository;private readonly CourseRepository courseRepository;private readonly InstructorRepository instructorRepository;public ScheduleController(){db new RoslyDbEntities();courseRepository new CourseRepository( db);

scheduleRepository new ScheduleRepository( db);locationRepository new LocationRepository( db);instructorRepository new InstructorRepository( db);}// GET: Schedulepublic ActionResult Index(){return View();}// Get: Courses/Create[Authorize]public ActionResult Create(){var areas locationRepository.GetLocations();var instructors instructorRepository.GetInstructors();//var course db.Courses.SingleOrDefault(c c.id id);var courses courseRepository.GetCourses();var viewModel new ScheduleFormViewModel(){Areas areas,Instructors instructors,Courses courses};return View("ScheduleForm", viewModel);}// Post: [Authorize]public ActionResult Create(ScheduleFormViewModel viewModel){if (!ModelState.IsValid){viewModel.Areas ctors Course viewModel.Course;viewModel.Courses courseRepository.GetCourses();return View("ScheduleForm", viewModel);}var course new Schedule(){Course courseRepository.GetCourse(viewModel.Course),start date viewModel.GetDateTime(),end date viewModel.GetDateTime(),area viewModel.Area,Instructor uctor),max capacity viewModel.MaxCapacity,num of students 0,};db.Schedules.Add(course);

db.SaveChanges();return RedirectToAction("Index", "Courses");}[Authorize]public ActionResult Edit(int id){var course scheduleRepository.GetScheduledCourse(id);if (course null)return HttpNotFound();var viewModel new ScheduleFormViewModel(){Id id,StartDate course.start date.ToString("d MMM yyyy"),StartTime course.start date.ToString("HH:mm"),Areas locationRepository.GetLocations(),Area course.area,MaxCapacity course.max capacity,Courses courseRepository.GetCourses(),Instructors instructorRepository.GetInstructors(),Instructor course.Instructor.email,Course course.Course.id};return View("ScheduleForm", uthorize]public ActionResult Update(ScheduleFormViewModel viewModel){if (!ModelState.IsValid){viewModel.Areas s s instructorRepository.GetInstructors();return View("ScheduleForm", viewModel);}var course );var instructor uctor);course.Modify(viewModel.GetDateTime(), viewModel.Area, instructor,viewModel.MaxCapacity);//course.course id viewModel.CourseId;//course.start date viewModel.GetDateTime();//course.area viewModel.Area;//course.Instructor db.Instructors.Single(i i.email viewModel.Instructor);////course.description viewModel.Description;//course.max capacity viewModel.MaxCapacity;db.SaveChanges();

return RedirectToAction("Index", "Courses");}// Get: Courses/Details/5public ActionResult Details(int? id){if (id null){return new ar schedule scheduleRepository.Find(id);if (schedule null){return HttpNotFound();}var students schedule.Enrollments.Select(e e.Employee);var viewModel new ScheduleDetailsViewModel(){EnrolledEmployees students,Area schedule.area,Id schedule.id,StartDate schedule.start date.ToString("MMM dd, yyyy"),NumOfStudents schedule.num of students,MaxCapacity schedule.max capacity,Description schedule.Course.description,Name schedule.Course.course id};return View(viewModel);}}}The controller will then check to see if the fields are valid or not, if they are not it will return theuser back to the form. If the fields are valid it will create a new Schedule object :\Models\Schedule.cs ok Microsoft.Office.Interop.Outlook;public partial class ableMethodsInConstructors")]public Schedule(){this.Enrollments new Collection Enrollment ();

this.Notifications new HashSet Notification icpublicint id { get; set; }System.DateTime start date { get; set; }System.DateTime end date { get; set; }string area { get; set; }int max capacity { get; set; }int num of students { get; set; }Nullable bool is canceled { get; private set; }int course id { get; set; }int instructor id { get; set; }public virtual Course Course { get; set; ldBeReadOnly")]public virtual ICollection Enrollment Enrollments { get; set; }public virtual Instructor Instructor { get; set; }public virtual Location Location { get; set; ldBeReadOnly")]public virtual ICollection Notification Notifications { get; set; }public void Cancel(){is canceled true;var notification Notification.CourseCanceled(this);//var attendees db.Enrollments//.Where(e e.schedule id course.id)//.Select(e e.Employee)//.ToList();EmailService emailService new se();foreach (var employee in Enrollments.Select(e e.Employee)){employee.Notify(notification, true);//SendNotification(employee.email);}}private void SendNotification(string email){try{Outlook. Application app new Outlook.Application();Outlook.MailItem mail (Outlook.MailItem) .To email;mail.Subject "Course Cancelled";mail.Body "The course you enrolled in was cancelled";mail.Importance Outlook.OlImportance.olImportanceNormal;((Outlook. MailItem)mail).Send();Console.WriteLine("Your email was sent successfully.");}

catch (Exception e){Console.WriteLine("Error sending email" e.ToString());throw;}}public void Modify(DateTime dateTime, string area, Instructor instructor, intMaxCapacity){if (is canceled true)return;var notification Notification.CourseUpdated(this, start date, area);start date dateTime;this.area area;Instructor instructor;max capacity MaxCapacity;EmailService emailService new ng(notification);foreach (var employee in Enrollments.Select(e e.Employee)){employee.Notify(notification, true);}}public void Enroll(Employee employee){if (is canceled true)return;var enrollment new Enrollment(){Employee employee,Schedule this,timestamp DateTime.Now};Enrollments.Add(enrollment);var notification nvite(notification, this, true);}}}To set the Course value it will make a call to the GetCourse in the Course repository :\Repositories\CourseRepository.cs .Tasks;

using Rosly.Models;namespace Rosly.Repositories{public class CourseRepository{private readonly RoslyDbEntities db;public CourseRepository(RoslyDbEntities db){db db;}public Course GetCourse(int id){return db.Courses.Single(c c.id id);}public IEnumerable Course GetCourses(){return db.Courses.ToList();}}}The GetCourse method will return a single course that has the same id as the given value.To set the value of the

HomeHome PageViewsHome \Home\Index.cshtmlViewModelsNoneControllersHome Index

RepositoriesNone

CourseCreateViewsShared \Shared\ Layout.cshtml\Shared\CourseForm.cshtmlo Course Name – String max 10 characterso Description – String maxViewModels esController \Controllers\CoursesController.cs

oCreate(): Creates course then returns to schedule.RepositoriesNone

EditViewsShared \Shared\ Layout.cshtml\Shared\CourseForm.cshtmlo Course Name – String max 10 characterso Description – String maxViewModels es \Controllers\CoursesController.cs

ooEdit(): loads CourseForm and fills with appropriate info calls Update() method on buttonpressUpdate: checks if input is valid. If input is valid course is updated then returns to thescheduleRepositoriesCourseRepository \Repositories\CourseRepository.cso GetCourse() – finds a single course by its id

DetailsViewsShared \Views\Shared\ Layout.cshtmlCourses \Views\Courses\Details.cshtmlo Description: Description of courseo Course Schedule: Shows date, time, and location of upcoming classes for given courseo Register Button: Takes you to course registration pageViewModels \ViewModels\CourseDetailsViewModel.cs

ControllersCoursesController \Controllers\CoursesController.cso Details() : shows details of the course and upcoming classes for the courseRepositoriesScheduleRepository \Repositories\ScheduleRepository.cso GetUpcomingScheduleByCourse() : returns upcoming schedule for a given courseCourseRepository \Repositories\CourseRepository.cso GetCourse() : returns a single course by its id

ScheduleIndexViewsShared \Views\Shared\ Layout.cshmtlCourses \Views\Courses\Index.cshtmlo Course Name: Name of courseo Location: Location of courseo Start Time: Start date and time of courseo Capacity: How many students are enrolled and the max capacity

oActions: Actions to be performed on a courseViewModels \ViewModels\CoursesViewModel.csControllersCourses \Controllers\CoursesController.cso Index() : Shows list of upcoming coursesRepositoriesRepositoriesScheduleRepository \Repositories\ScheduleRepository.cso GetUpcomingCourses() : Returns a list of upcoming coursesLocationRepository \Repositories\LocationRepository.cso GetLocations() : Returns a list of all locations

Add Course To ScheduleViewsShared \Views\Shared\ Layout.cshtml\Views\Shared\ScheduleForm.cshtmlo Courses Dropdown – select course you would like to add to scheduleo Start Date – date the course will be taughto Start Time – time the course will be taughto Instructor dropdown – select instructor who will be teaching course. Shows their emailo Area dropdown – Location the course will be taughto Max Capacity – Total number of employees that can take this courseViewModels \Views\Shared\ScheduleFormViewModel.cs

ControllersScheduleController \Controllers\ScheduleController.cso Create(): add course to schedule for employees to enroll in.RepositoryLocationRepository \Repositories\LocationRepository.cso GetLocations() : Returns list of all locationsInstructorRepository \Repositories\InstructorRepository.cso GetInstructors() : Returns list of all instructorsCourseRepository \Repositories\CourseRepository.cso GetCourses() : Returns list of all courses

EditViewsShared Layout.cshtmlCourses Details.cshtmlo Description: Description of courseo Course Schedule: Shows date, time, and location of upcoming classes for given courseo Register Button: Takes you to course registration pageViewModels \ViewModels\CourseDetailsViewModel.cs

ControllersScheduleController \Controllers\ScheduleController.cso Edit() : Edit the details of the scheduled course. Create notifications for enrolledemployees.RepositoriesLocationRepository \Repositories\LocationRepository.cso GetLocations() : Returns list of all locationsCourseRepository \Repositories\CoursesRepository.cso GetCourses() : Returns list of all coursesInstructorRepository \Repositories\InstructorRepository.cso GetInstructors() : Returns list of all instructorsScheduleRepository \Repositories\ScheduleRepository.cso GetScheduledCourse() : Returns a single scheduled course

DetailsViewsShared \Views\Shared\ Layout.cshtmlSchedule \Views\Schedule\Details.cshtmlo Name: Name of courseo Date: Start time/date of courseo Location: location course is being taught ato Description: description of courseo Capacity: (Number of students enrolled) / (Max Capacity)o Enrolled Employees: List of employees enrolled in courseViewModels ScheduleDetailsViewModel.cs

ControllersSchedule \Controlelrs\ScheduleController.cso Details(): Get details of a scheduled course including who is enrolled in it.RepositoryScheduleRepository \Repositories\ScheduleRepository.cso Find() : Returns a single scheduled course

EmployeeEnroll employeeViewsShared \Views\Shared\ Layout.cshtml\Views\Shared\EmployeeForm.cshtmlo Last Name (Required) – String max length 20 characters. Maps to LastName in viewmodel.o First Name (Required) – String max length 20 characters. Maps to FirstName in viewmodel.o Email (required) – String maxlength 254 characters. Maps to email in view model

ViewModels ler \Controllers\EmployeeController.cso Enroll() : enrolls employee in course. If employee does not exist takes them to form forenrolling new employees.RepositoriesLocationRepository \Repositories\LocationRepository.cso GetLocations() : Returns all locationsEmployeeRepository \Repositories\EmployeeRepository.cso GetEmployee() : Returns a single employee by idEnrollmentRepository \Repositories\EnrollmentRepository.cso IsEnrolled() : Returns true or false if employee is enrolled or notScheduleRepository \Repositories\ScheduleRepository.cso GetScheduledCourse() : Returns a scheduled course

Enroll New EmployeeViewsShared \Views\Shared\ Layout.cshtml\Views\Shared\EmployeeForm.cshtmlo Last Name (Required) – String max length 20 characters. Maps to LastName in viewmodel.o First Name (Required) – String max length 20 characters. Maps to FirstName in viewmodel.o Email (required) – String maxlength 254 characters. Maps to email in view modelo Business Unit (required) – String max length 10 characters. Maps to BusUnit in viewmodel.o Cost Center (required) – Long. Maps to CostCent in view model.o Cube Location (required) – String. Maps to CubeLocation in view model.o Area dropdown (required) – Drop down of locations. Maps to Area in view model.o Employee id – Long. Maps to EmployeeId in view model.

ViewModels ler \Controllers\EmployeeControll

Rosly Course Registration System Software Code walk Through by Derrick Awuah PlatformsPlatformslatforms ASP.NET MVC 5 ASP.NET MVC 5