c# - ASP.Net MVC 4 - Manually adding values to the database -


I am quite new to ASP and MVC and am making a basic application based on a tutorial.

The app is a form with three different steps: -

  • Step 1 is a form requesting basic details
  • Step 2 of the family
  • Step 3 is a form with some other description

My app has a database that includes fields for different timestamps: - < / P>

  • Step 1 Tilestamp
  • Step 2 Timestamp
  • Step 3 Timestamp

As if the user steps each step To complete Does, I want to push one value to the database representing these timestamps.

I have failed to understand how to do it manually.

Let me show you an example of your form:

  @using (html BeginForm ()) {@ Html.AntiForgeryToken () @html. Validity beautiful (true) @HTMLEditorFor (model = & gt; model. Customer first name) @ Html.EditorFor (model => model.super CustomerSurname)}  

After that, my In the controller, I have just one method that automatically pulls this data from data with data:

  [HttpPost] [validAnneGeneratorToken] Public Task Summary Summary (customer customer, int ? SomeJargValue) {try {// push data to database at this point if (ModelState. E-waleed) {db.Customers.Add (customer); Db.SaveChanges (); // At this point - what if I want to add additional data to the database which is not present in this form? Is there a db.Customers.setfield or something else? Redirection Reaction ("Database Entities", Customers); }} Hold (dataexation dex) {ModelState.AddModelError ("", "Unable to save changes. Retry, and if your problem persists, see your system administrator. \ N Error Description:" + Dax ") ; System.Diagnostics.Debug.WriteLine ("An error occurred while attempting to save the change:" + Decks);} View return (customer);}  

Return statement in the above snippet of code Please see my comment above.

Thanks!

I want to add some data to the fields that are not present in the form.

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -