public async Task UpdateUserTempalteContent(int nTemplateID, string strTemplateContent) { DbpUsertemplate userTemplate = await Store.GetUsertemplateAsync(a => a.Where(x => x.Templateid == nTemplateID), true); if (userTemplate != null && userTemplate.Templateid <= 0) { SobeyRecException.ThrowSelfOneParam(nTemplateID.ToString(), GlobalDictionary.GLOBALDICT_CODE_CAN_NOT_FIND_THE_TEMPLATE_ID_IS_ONEPARAM, null, string.Format(GlobalDictionary.Instance.GetMessageByCode(GlobalDictionary.GLOBALDICT_CODE_CAN_NOT_FIND_THE_TEMPLATE_ID_IS_ONEPARAM), nTemplateID), null); return; } await Store.ModifyUserTempalteContent(nTemplateID, strTemplateContent); }
public async Task ModifyUserTempalteContent(int templateID, string templateContent) { try { var userTemplate = new DbpUsertemplate() { Templateid = templateID, Templatecontent = templateContent }; Context.Attach(userTemplate); Context.Entry(userTemplate).Property(x => x.Templatecontent).IsModified = true; await Context.SaveChangesAsync(); } catch (Exception ex) { Logger.Error("ModifyUserTempalteContent : " + ex.ToString()); throw ex; } }