Click here to Skip to main content
15,888,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900