Take input values in html for object in ASP.NET MVC

Asked

Viewed 426 times

-3

I wanted to know how to get the information of the data entered in the html input to create an object by my MVC model and save it in the database. Note: I already have all model classes, interface classes, I just need to assemble the objects with the data to post the data.

![Follow screenshot of how html is]http://imgur.com/8DQeWfR

A piece of HTML:

<div class="form-group">
     <label for="Email" class="control-label">Email</label>
     <input type="email" class="form-control" id="Email" placeholder="Email" data-error="Bruh, that email address is invalid" required>
     <div class="help-block with-errors"></div>
</div>

1 answer

-2


Good evening to you... I’m understanding that Voce is working with MVC... so it would look something like this the form triggers the Controller that must execute the following code:

[HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create([Bind(Include = Email)] Project project, HttpPostedFileBase filetransfer)
    {
            context.Project.Add(project);
            context.SaveChanges();

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.