C# Can';不要将条目添加到存储库中
我有一个db和ET数据库模型。我使用PostgreSQL 当我试图将条目添加到网格时,什么都没有发生。但删除和编辑的工作很好。 我该怎么办 谢谢 这是控制器代码C# Can';不要将条目添加到存储库中,c#,jquery,asp.net-mvc-3,jquery-ui,postgresql,C#,Jquery,Asp.net Mvc 3,Jquery Ui,Postgresql,我有一个db和ET数据库模型。我使用PostgreSQL 当我试图将条目添加到网格时,什么都没有发生。但删除和编辑的工作很好。 我该怎么办 谢谢 这是控制器代码 public ActionResult GetFormForAddOrEdit(string id) { if (string.IsNullOrEmpty(id)) { return PartialView(new TypeDictModel()); }
public ActionResult GetFormForAddOrEdit(string id)
{
if (string.IsNullOrEmpty(id))
{
return PartialView(new TypeDictModel());
}
else
{
TypeDict td = typeDictRepo.GetById(id);
TypeDictModel tdt = new TypeDictModel() { Oid = td.Oid, FormOfProduction = td.FormOfProduction };
return PartialView(tdt);
}
}
public virtual string SaveTypeDictEntry(TypeDictModel tdm)
{
string newTDE = typeDictRepo.Save(tdm.Oid, tdm.FormOfProduction);
return newTDE;
}
public virtual void DeleteEntry(string id)
{
typeDictRepo.Delete(id);
}
这里是视图
function CloseTypeDictModal() {
$('#EditTypeDictModal_Close').click();
}
function SaveNewEntry() {
$.ajax({
url: '@Url.Action("SaveTypeDictEntry", "TypeDict")',
async: true,
dataType: "html",
type: 'POST',
data: $('#TypeDictForm').serialize(),
success: function (data) {
CloseTypeDictModal();
$('#newTypeDictGrid').jqGrid().trigger("reloadGrid");
}
});
}
修复了我的存储。缺少此行上下文。SaveChanges();^ 你的保存方法在仓库里做什么?您是否使用断点来查看发生了什么?是否可以定义NotWorks?预期结果是什么?实际结果是什么?这是我的