Question
I am having problems with the method of the controller using Microsoft.AspNetCore.MVC using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Dropbox2A.Controllers {
I am having problems with the method of the controller
using Microsoft.AspNetCore.MVC
using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks;
namespace Dropbox2A.Controllers { public class EmployeeController : Controller { //GET: /
return $"{name}'s pay amount is {PayAmount}"; } } }
Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc;
namespace Dropbox2A { public class Startup { // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
app.UseRouting();
app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); } } }
When the user enters the following URL
https://localhost:44335/Employee/PayAmount?name=Lynn&rate=25&hours=12
- 0 1 X Cartup.cs Dropbox2A EmployeeController.cs* + x Dropbox2A: Overview Dropbox2A.Controllers. EmployeeController Solution Explorer www.www.www. PayAmount(string name, int rate, int hours) 8 { 9 10 11 12 13 O references public class EmployeeController : Controller { //GET: /Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started