private GW_SealChangeDto GetChangeModel(GW_Seal model) { /// 如果有外键数据 在这里转换 var ret = new GW_SealChangeDto(); ret.Id = model.Id; ret.Name = model.Name; ret.KeepUser_Name = UserManager.Users.SingleOrDefault(r => r.Id == model.KeepUser).Name; ret.AuditUser_Name = string.Join(",", UserManager.Users.Where(r => model.AuditUser.GetStrContainsArray(r.Id.ToString())).Select(r => r.Name)); ret.SealType_Name = model.SealType.ToString(); ret.Status_Title = model.Status.ToString(); ret.Remark = model.Remark; return(ret); }
/// <summary> /// 添加一个GW_Seal /// </summary> /// <param name="input">实体</param> /// <returns></returns> public async Task Create(CreateGW_SealInput input) { if (_repository.GetAll().Any(r => r.Name == input.Name && r.SealType == input.SealType)) { throw new UserFriendlyException((int)ErrorCode.BussinessDataException, "同类型公章名称重复。"); } var newmodel = new GW_Seal() { Id = Guid.NewGuid(), Name = input.Name, KeepUser = input.KeepUser, AuditUser = input.AuditUser, SealType = input.SealType, Status = input.Status, Remark = input.Remark }; if (input.FileList != null) { var fileList = new List <AbpFileListInput>(); foreach (var item in input.FileList) { fileList.Add(new AbpFileListInput() { Id = item.Id, Sort = item.Sort }); } await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput() { BusinessId = newmodel.Id.ToString(), BusinessType = (int)AbpFileBusinessType.公章图片, Files = fileList }); } await _repository.InsertAsync(newmodel); }