2012-05-21 38 views
0

我有一個db和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"); 
     } 
    }); 
} 

+0

你的儲存方法在倉庫裏做什​​麼?你是否使用斷點來看看會發生什麼? – Shyju

+2

你可以定義*不工作*?預期是什麼,實際結果是什麼? –

+0

http://img209.imageshack.us/img209/8576/qweqwec.png這是我所擁有的 – kirqe

回答

1

固定我repositorys。錯過了這一行Context.SaveChanges(); ^^

相關問題