嗨,我希望从我的视图中捕获值并将输入的值更新到我的数据库中。
我的观点如下:
@using Kendo.Mvc.UI
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Facility</title>
</head>
<body>
<div>
<p>Create a new Facilty</p>
<table width="100px">
<tr>
<td>
<label for="TenantId">TenantID:</label>
</td>
<td>
<input id="TextTenantId" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityID">FacilityID:</label>
</td>
<td>
<input id="TextFacilityID" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityGroupID">FacilityGroupID:</label>
</td>
<td>
<input id="TextFacilityGroupID" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityName">FacilityName:</label>
</td>
<td>
<input id="TextFacilityName" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityAddressLine1">FacilityAddressLine1:</label>
</td>
<td>
<input id="TextFacilityAddressLine1" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityAddressLine2">FacilityAddressLine1:</label>
</td>
<td>
<input id="TextFacilityAddressLine2" type="text" />
</td>
</tr>
<tr>
<td>
<label for="FacilityAddressLine3">FacilityAddressLine1:</label>
</td>
<td>
<input id="TextFacilityAddressLine3" type="text" />
</td>
</tr>
<tr>
<td>
<label for="CityId">CityId:</label>
</td>
<td>
<input id="TextCityId" type="text" />
</td>
</tr>
<tr>
<td>
<label for="StateId">StateId:</label>
</td>
<td>
<input id="TextStateId" type="text" />
</td>
</tr>
<tr>
<td>
<label for="CountryId">CountryId:</label>
</td>
<td>
<input id="TextCountryId" type="text" />
</td>
</tr>
<tr>
<td>
<label for="Zipcode">Zipcode:</label>
</td>
<td>
<input id="TextZipcode" type="text" />
</td>
</tr>
<tr>
<td>
<label for="PhoneNo">PhoneNo:</label>
</td>
<td>
<input id="TextPhoneNo" type="text" />
</td>
</tr>
<tr>
<td>
<label for="Status">Status:</label>
</td>
<td>
<input id="TextStatus" type="text" />
</td>
</tr>
<tr>
<td>
<label for="EmailId">EmailId:</label>
</td>
<td>
<input id="TextEmailId" type="text" />
</td>
</tr>
<tr>
<td>
<label for="Website">Website:</label>
</td>
<td>
<input id="TextWebsite" type="text" />
</td>
</tr>
<tr>
<td>
<input id="Submit1" type="Submit" value="submit" />
</td>
</tr>
</table>
</div>
</body>
</html>
我的模型看起来像:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace AmanoMockUp.Models
{
public class FacilityModels
{
public int TenantId { get; set; }
public int FacilityId { get; set; }
public int FacilityGroupId { get; set; }
public string FacilityName { get; set; }
public string FacilityAddressLine1 { get; set; }
public string FacilityAddressLine2 { get; set; }
public string FacilityAddressLine3 { get; set; }
public int CityId { get; set; }
public int StateId { get; set; }
public int CountryId { get; set; }
public string Zipcode { get; set; }
public int PhoneNo { get; set; }
public bool status { get; set; }
public string EmailId { get; set; }
public string Website { get; set; }
public DateTime CreationDate { get; set; }
}
}
现在我需要在提交按钮时将在各种文本字段中的视图中输入的值更新到我的数据库中
<input id="Submit1" type="Submit" value="submit" />
我应该在哪里写 buttonclick 事件应该在控制器或模型上,或者我应该为同一个控制器创建一个全新的控制器。请帮助!我已经搜索过,但找不到与我的问题相关的任何内容。提前谢谢!!