public OperationResult UpsertInputConfig(InputConfigDto dto) { var section = SectionConfig.FindById(dto.SectionId); if (section == null) { return(new OperationResult(StatusCode.NotFound, "").SetExtras(dto.Id)); } else { section.UpsertInputConfig(dto); return(UnitOfWork.Commit() > 0 ? new OperationResult(StatusCode.Okey).SetExtras(section.Input.Id) : new OperationResult(StatusCode.Failed).SetExtras(section.Input.Id)); } }
public OperationResult UpdateSectionConfig(SectionConfigDto dto) { var section = SectionConfig.FindById(dto.Id); if (section == null) { return(new OperationResult(StatusCode.NotFound)); } else { section.Name = dto.Name; section.Index = dto.Index; section.IsRepeatable = dto.IsRepeatable; SectionConfig.Update(section); return(UnitOfWork.Commit() > 0 ? new OperationResult(StatusCode.Okey) : new OperationResult(StatusCode.Error, "没有做过任何修改吧?")); } }
public void TestDeleteById() { var section = SectionConfig.FindById(1); ArticleConfig.Delete(1); }