1. this my html
@Html.EditorFor(model => model.BookingRefNo, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly", @name="testname1"} })
2. My Form POST
@using (Html.BeginForm("CloseCustomerOrder", "FoodMasterFile", FormMethod.Post, new { id = "addfrm" }))
3. My model
@model OrderService.Data.Model.CustomerOderTransList
4. my Controller
public async Task<IActionResult> CloseCustomerOrder(string testname1)
{
try
{
using (HttpClient client = new HttpClient())
{
StringContent content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");
string endpoint = apiBaseUrl + "/AddOrderTransHdrTbl";
using (var Response = await client.PostAsync(endpoint, content))
{
if (Response.StatusCode == System.Net.HttpStatusCode.OK)
{
TempData["Profile"] = JsonConvert.SerializeObject(user);
}
else if (Response.StatusCode == System.Net.HttpStatusCode.Conflict)
{
ModelState.Clear();
ModelState.AddModelError("OrderFormEntry", "Records Already Exist");
return View();
}
else
{
return View();
}
}
}
return RedirectToAction("ViewCustomerOrderTrans", "CreateFoodOrder");
}
catch (ArgumentException ex)
{
Console.WriteLine($"Processing failed: {ex.Message.ToString()}");
throw;
}
}
What I have tried:
5. i wanted to get the value of
@Html.EditorFor(model => model.BookingRefNo, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly", @name="testname1"} })
and pass to my controller, it so happen during my click button dont not rout to my controller error page cannot be display 404