I tried to put the code as MVC c# form from console. I want to show key with account, meter numbers, but I have no idea what I'm wrong. What I want to try is that prints out all info in Details page.
Here is controller
public ActionResult Index()
{
return View(db.fedex.ToList());
}
private static RateRequest CreateRateRequest()
{
FedexModel fedex = new FedexModel();
// Build a RateRequest
RateRequest request = new RateRequest();
//
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.UserCredential.Key = fedex.AccessKey; // Replace "XXX" with the Key
request.WebAuthenticationDetail.UserCredential.Password = fedex.Password; // Replace "XXX" with the Password
//
request.ClientDetail = new ClientDetail();
request.ClientDetail.AccountNumber = fedex.AccountNumber; // Replace "XXX" with the client's account number
request.ClientDetail.MeterNumber = fedex.MeterNumber; // Replace "XXX" with the client's meter number
//
request.TransactionDetail = new TransactionDetail();
request.TransactionDetail.CustomerTransactionId = "***Rate v14 Request using VC#***"; // This is a reference field for the customer. Any value can be used and will be provided in the response.
//
request.Version = new VersionId();
//
request.ReturnTransitAndCommit = true;
request.ReturnTransitAndCommitSpecified = true;
//
//SetShipmentDetails(request);
//
return request;
}
//
// GET: /Fedex/Details/5
public ActionResult Details(int id = 0)
{
var request = CreateRateRequest();
return View(request);
}
If I click the key then it goes to next in Details page.
Details View
@model FedExShipping.Models.FedexModel
@using FedExShipping.WebReference;
@using FedExShipping.Controllers;
<h2>Details</h2>
<fieldset>
<legend>FedexModel</legend>
<div>
@Html.DisplayFor(model => model.AccessKey)
</div>
<div>
@Html.DisplayFor(model => model.Password)
</div>
<div>
@Html.DisplayFor(model => model.AccountNumber)
</div>
<div>
@Html.DisplayFor(model => model.MeterNumber)
</div>
What do I need to change for correct output?