public void SubmitForm(NewsEntity entity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); service.Update(entity); } else { entity.Create(); service.Insert(entity); } }
public async Task SaveForm(NewsEntity entity) { if (entity.Id.IsNullOrZero()) { await entity.Create(); await this.BaseRepository().Insert <NewsEntity>(entity); } else { await entity.Modify(); await this.BaseRepository().Update <NewsEntity>(entity); } }
public int SubmitForm(NewsEntity newsEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { newsEntity.F_Id = keyValue; return(_service.Update(newsEntity)); } else { newsEntity.F_Id = Common.GuId(); newsEntity.F_Id = keyValue; newsEntity.Create(); return(_service.Insert(newsEntity)); } }
/// <summary> /// 保存新闻表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="newsEntity">新闻实体</param> /// <returns></returns> public void SaveForm(string keyValue, NewsEntity newsEntity) { if (!string.IsNullOrEmpty(keyValue)) { newsEntity.Modify(keyValue); newsEntity.TypeId = 1; this.BaseRepository().Update <NewsEntity>(newsEntity); } else { newsEntity.Create(); newsEntity.TypeId = 1; this.BaseRepository().Insert <NewsEntity>(newsEntity); } }