开发者

Saving data with Razor

开发者 https://www.devze.com 2023-03-16 23:51 出处:网络
How do I save data with Razor? If I create a form to gather customer details how do I then create a n开发者_高级运维ew customer like Customer c = new Customer(){name= nameTextBox.Name} if there are no

How do I save data with Razor? If I create a form to gather customer details how do I then create a n开发者_高级运维ew customer like Customer c = new Customer(){name= nameTextBox.Name} if there are no server side controls? With Razor it seems easy to display data, but I just don't understand how we collect data like we do with Web Forms?


In controller you get back the model in parameter:

public ActionResult Create(Customer model)
{
    SaveCustomer(model);

    return View();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消