public ActionResult _Insert(GridCommand command,HuMemo huMemo, string CodeTo, string DescriptionTo) { HuMemoSearchModel searchModel = new HuMemoSearchModel(); searchModel.Code = CodeTo; searchModel.Description = DescriptionTo; if (ModelState.IsValid) { IList<HuMemo> huMemoList = genericMgr.FindAll<HuMemo>("from HuMemo as h where h.Code=?", huMemo.Code); if (huMemoList.Count > 0) { SaveErrorMessage(Resources.EXT.ControllerLan.Con_CodeAlreadyExists); return PartialView(); } else { huMemo.ResourceGroup = (com.Sconit.CodeMaster.ResourceGroup)Enum.Parse(typeof(com.Sconit.CodeMaster.ResourceGroup), huMemo.ResourceGroupDescription, true); genericMgr.CreateWithTrim(huMemo); } } SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<HuMemo>(searchStatementModel, command)); }
public ActionResult _Update(GridCommand command,HuMemo huMemo, string id, string CodeTo, string DescriptionTo) { HuMemoSearchModel searchModel = new HuMemoSearchModel(); searchModel.Code = CodeTo; searchModel.Description = DescriptionTo; ModelState.Remove("Code"); HuMemo newHuMemo = genericMgr.FindById<HuMemo>(id); newHuMemo.Code = id; newHuMemo.Description = huMemo.Description; newHuMemo.ResourceGroup = (com.Sconit.CodeMaster.ResourceGroup)Enum.Parse(typeof(com.Sconit.CodeMaster.ResourceGroup), huMemo.ResourceGroupDescription, true); genericMgr.UpdateWithTrim(newHuMemo); SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<HuMemo>(searchStatementModel, command)); }