Exemplo n.º 1
0
        public async Task <ApiResourceDTO> AddAsync(ApiResourceDTO dto)
        {
            var entity = dto.ToEntity();
            await Apis.AddAsync(entity);

            await Context.SaveChangesAsync();

            return(entity.ToDTO());
        }
Exemplo n.º 2
0
        public async Task <ApiResourceDTO> UpdateAsync(ApiResourceDTO dto)
        {
            var entity = dto.ToEntity();

            Apis.Attach(entity);
            await CleanupApiResourceAsync(entity);

            Apis.Update(entity);
            await Context.SaveChangesAsync();

            return(entity.ToDTO());
        }