Question

Build a project with using C# and MVC The site can have any content/theme that you...

Build a project with using C# and MVC

The site can have any content/theme that you want (be creative). The only requirements are as follows:

1) The site should have at least 2 different routes (for example: home and about routes/pages)

Homework Answers

Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a new Asp.net MVC web application in C# is created using Visual Studio 2017 with name "TechNewsWebApplication".This application contains below details.

NOTE :Images are used for demonstration purpose only.

Solution Explorer :

HomeController.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TechNewsWebApplication.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
}

******************************

Index.cshtml :


@{
ViewBag.Title = "TechNews";
}

<img src="~/Images/apple.png" />
<h1>Apple will launch Iphone 11 and IOS 13 on 10th sep 2019.</h1>
<hr /><hr />
<img src="~/Images/oneplus.jpg"/>
<h1>Oneplus 7T will be launched in 05th Oct 2019 in India</h1>
<hr /><hr />
<img src="~/Images/amazon.png" />
<h1>Amazon has announced great indian dewali sell.</h1>
<hr /><hr />

*******************************

_Layout.cshtml :

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - TechNews Pvt Ltd.</title>
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("TechNews Pvt Ltd.", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })

</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
@Html.ActionLink("Registration", "Register", "Registration", new { area = "" }, new { @class = "navbar-brand" })
</li>
</ul>
</div>
</div>
</div>

<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; @DateTime.Now.Year - TechNews Pvt Ltd.</p>
</footer>
</div>

<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
</body>
</html>

******************************

site.css :

body {
padding-top: 50px;
padding-bottom: 20px;
}

/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}

/* Set width on the form input elements since they're 100% wide by default */
input[type='text'],input[type='email'],
select{
height: 60px;
width: 300px;
font-size: 22px;
padding: 20px;
margin: 10px;
}
/*style for h1*/
h1{
display:inline;
}
/*style for image*/
img{
height:150px;
width:150px;
padding:10px;
border:2px solid green;
}
/*style for button*/
input[type='submit'], input[type='reset'] {
background-color: lightgreen;
color: maroon;
margin: 10px;
width: 150px;
height: 60px;
}
*****************************

RegistrationController.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TechNewsWebApplication.Controllers
{
public class RegistrationController : Controller
{
// GET: Registration
public ActionResult Register()
{
return View();
}
}
}

******************************

Register.cshtml :


@{
ViewBag.Title = "Register";
}
<br />
<h1>Register for Event</h1>
<table>
<tr>
<td>Name</td>
<td>
<input type="text" id="txtName" placeholder="Enter Name" />
</td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="email" id="txtEmail" placeholder="Enter Email" />
</td>
</tr>
<tr>
<td>Select Event</td>
<td>
<select>
<option>Apple 11 launch</option>
<option>Oneplus 7T launch</option>
<option>Amazon Sell</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>
  
</td>
<td>
<input type="submit" />
<input type="reset" />
</td>
</tr>
</table>
******************************

RouteConfig.cs :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace TechNewsWebApplication
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :Index.cshtml

Screen 2 :Register.cshtml

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Company XYZ owns a social network web site dedicated for wind surfers. They plan to launch...
Company XYZ owns a social network web site dedicated for wind surfers. They plan to launch a new online ad delivery and management service web site that will be coupled with their existing social network platform. The online ad management service will enable them to accept online orders for online ads from advertisers. The system will also deliver the ads to the main social network site. The ads will be displayed on the social network site but the content of...
Project 6-Printing a Formatted Report Printing a formatted report from the DDI.LEDGER_VIEW USING Head of Forms,...
Project 6-Printing a Formatted Report Printing a formatted report from the DDI.LEDGER_VIEW USING Head of Forms, Form Breaks, and an End of Form 70. Requirements: Build a report using the ledger view I would like you use at least 4 techniques you have learned in this course such as Any Report formatting techniques Any Data formatting techniques Any Error handling techniques Any OOP techniques such as data types. Any Cursor techniques USING Head of Forms, Form Breaks <- are not...
(Use the case of “Global Treps”) You have been selected as the project manager for the...
(Use the case of “Global Treps”) You have been selected as the project manager for the Global Treps project. You helped to run a local shark tank like event at your college last year as part of a class project, so you have a general idea of what is involved. The schedule goal is six months, and the budget is $120,000. Your favorite professor, Dr. K., and a few of her associates have agreed to fund the project. Your strengths...
Company X want to Invest to project A, B or C (the company can only invest...
Company X want to Invest to project A, B or C (the company can only invest in one project (A, B or C) or the company can choose not invest to any project (DN (do nothing)). Based on the incremental analysis rates of return shown below, what alternative should company X choose (MARR = 10%)? Comparison IRR A - DN -3% B - DN -2% C - DN 8% B - A 12% C - B 15% C - A...
The magic and excitement of theme parks have enthralled Rabea since her first visit to the...
The magic and excitement of theme parks have enthralled Rabea since her first visit to the Ferrari theme park in Abu Dhabi, a few years ago. The characters, the enchanted atmosphere, the immaculate park grounds, and the stories told by the Ferrari theme park employees – all of this made such a memorable impression that Rabea would now like to use a theme park as the focus for her Masters’ research project at Al Ain University. Her interest in the...
please I want you to answer this question and most importantly, the answer is not already...
please I want you to answer this question and most importantly, the answer is not already available on this site or other site Course Learning Outcome: Apply Organizational behavior knowledge and skills to manage diversified culture in the organizational settings (Lo 2.2). Essay: Differences in Culture and Diversity at workplace Essay Write an essay about the differences in Culture and Diversity at workplace. Use examples, peer-reviewed journals to support your answer. This essay must be at least 1000-word in length....
IDEAS PLEASE below are the requirements and what i need ideas maybe sources to write the...
IDEAS PLEASE below are the requirements and what i need ideas maybe sources to write the paper FASB Project "The mission of the Financial Accounting Standards Board is to establish and improve standards of financial accounting reporting for the guidance and education of the public, including issuers, auditors, and users of financial information." (http://www.fasb.org) Project Objective Describe the history, current status, and adoption implications of a Financial Accounting Standards Board ongoing project. Requirements The FASB has several ongoing projects that...
Required information Chapter 17 Case: Reducing Ambiguity in Business Requirements The number one reason projects fail...
Required information Chapter 17 Case: Reducing Ambiguity in Business Requirements The number one reason projects fail is bad business requirements. Business requirements are considered “bad” because of ambiguity or insufficient involvement of end users during analysis and design.     A requirement is unambiguous if it has the same interpretation for all parties. Different interpretations by different participants will usually result in unmet expectations. Here is an example of an ambiguous requirement and an example of an unambiguous requirement: • Ambiguous requirement:...
You are an archaeologist excavating an Archaic period (c. 3000 BCE) site on the Pacific coast...
You are an archaeologist excavating an Archaic period (c. 3000 BCE) site on the Pacific coast of Oaxaca, Mexico. At the site are the remains of household structures that were destroyed in a large fire, with a number of cooking and serving vessels apparently abandoned in place where they were last used, and a cemetery with a number of adult skeletons close to the houses. You want to learn more about the diet and social organization in the community. Houses...
Pro forma Budget You will select any company you would like. Select either the Balance Sheet...
Pro forma Budget You will select any company you would like. Select either the Balance Sheet or Income Statement from the company you choose. Place that information on the first tab. On a second tab build a budget of that financial statement. Increase the total budget by 15%. The 15% should be spread over at least 12 different accounts. Create a third tab. On that tab you will create a budget using the second tab information as the base. The...