MVC Model Update from another view

Robert Pettis 1 Reputation point
2022-08-08T05:51:57.377+00:00

Hello, I was looking for understanding how I pass data from a view.
For example, if I receive a shipment how can I update my inventory table from the shipment transaction?
All my models/views etc work on their own.

Thank you in advance.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,188 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Robert Pettis 1 Reputation point
    2022-08-08T14:27:33.383+00:00

    To clarify I have a view, a controller and a model. I have a form in which the users enter the data. All of which work.
    I would like to do is to pass some of this data to another controller's action method to write to the database.

    The current form is to receive a shipment of items via purchase order. My form receives the purchase order but I would like to now update the inventory table with the new inventory qty.


  2. Bruce (SqlWork.com) 56,686 Reputation points
    2022-08-08T16:17:36.057+00:00

    websites are stateless. how data is persisted between page requests is one of your main design decision. typically if you need to pass data from one controller to another (separate page requests) you would store the data in a persistent store. a common approach is staging tables in the database or to use session.

    object models are only passed from a controller to its view. binding is used to map form fields to controller parameters for view to controller data.

    on a redirect you can pass strings to a controller (query string parameters) but it is limited in size. a cookie (also limited in size) can also be used to store data.

    0 comments No comments