Beispiel #1
0
        public async Task <OwnerDto> AddAsync(OwnerDto owner)
        {
            var entity = await OwnerPropertyDbContext.Owners.AddAsync(owner.MapTo <Owner>());

            await SaveChangesAsync();

            return(entity.Entity.MapTo <OwnerDto>());
        }
Beispiel #2
0
        public async Task <OwnerDto> UpdateAsync(OwnerDto owner)
        {
            var currentOwner = await GetEntityByIdAsync(owner.Id);

            var newOwner = owner.MapTo <OwnerDto>();

            OwnerPropertyDbContext.Entry(currentOwner).CurrentValues.SetValues(newOwner);
            await SaveChangesAsync();

            return(newOwner.MapTo <OwnerDto>());
        }