public static SuccessResponseDto Create(IEntityDto entity) { return(new SuccessResponseDto() { Entities = new List <IEntityDto>() { entity } }); }
public static async Task <HttpResponseMessage> PutByIdAsync <TPrimaryKey>( this HttpClient client, string path, ITestOutputHelper output, IEntityDto <TPrimaryKey> dto ) { var builder = BuildPathWithEntity(client, path, dto); output.WriteLine($"METHOD PUT, url:'{builder.Uri.PathAndQuery}' dto:'{dto.ToJson()}'"); return(await WriteApiErrorAsync(await client.PutAsync(builder.Uri.PathAndQuery, dto.ToStringContent()), output)); }
public static async Task <HttpResponseMessage> DeleteAsync <TPrimaryKey>( this HttpClient client, string path, ITestOutputHelper output, IEntityDto <TPrimaryKey> dto ) { var builder = BuildPathWithEntity(client, path, dto); output.WriteLine($"METHOD DELETE, url:'{builder.Uri.PathAndQuery}'"); return(await WriteApiErrorAsync(await client.DeleteAsync(builder.Uri.PathAndQuery), output)); }
public static void ModifyBy <T>(this IEntity <T> entity, IEntityDto <T> obj) { if (!entity.Id.Equals(obj.Id)) { throw new Comm100Exception(100105, ErrorMessages.E100105); } foreach (var p in obj.GetType().GetProperties()) { if (p.Name == "Id") { continue; } var v = p.GetValue(obj); if (v != null) { entity.GetType().GetProperty(p.Name)?.SetValue(entity, v); } } }
public ModalHeaderViewModel(string title, IEntityDto <long> dto) { Title = $"{(dto.Id > 0 ? "编辑" : "新增")}{title}"; }
public Task <RoleDto> Get(IEntityDto <int> input) { throw new NotImplementedException(); }
public Task Delete(IEntityDto <int> input) { throw new NotImplementedException(); }
private static UriBuilder BuildPathWithEntity <TPrimaryKey>(HttpClient client, string path, IEntityDto <TPrimaryKey> dto) { return(BuildPathWithId(client, path, dto.Id)); }
public static TEntity ToEntity <TEntity, TEntityDto>(this IEntityDto entityDto) where TEntity : class, IEntity { return(entityDto == null ? null : Mapper.Map <TEntity>(entityDto)); }
public async Task <PersonDto> GetPersonForEdit(IEntityDto input) { var person = await _personRepository.GetAsync(input.Id); return(ObjectMapper.Map <PersonDto>(person)); }
protected void SetUpdateText(IEntityDto dto) { UpdateText = dto.Id.IsNullOrEmpty() ? "Criou" : "Atualizou"; }