无法将条目添加到存储库

本文关键字:存储 添加 | 更新日期: 2023-09-27 18:34:43

我有一个数据库和ET DBModel。我使用PostgreSQL。

当我尝试向网格添加条目时,没有任何反应。但是删除和编辑工作正常。我该怎么办?

谢谢。

这是控制器代码

 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");
        }
    });
} 

无法将条目添加到存储库

修复了我的存储库。错过了这一行 上下文.保存更改((; ^^