Beispiel #1
0
        public async Task <Models.AddressIndirection> PostAsync(Models.AddressIndirection AddressIndirection)
        {
            var a = await _db.AddAsync(new Models.AddressIndirection {
                CustomerId = AddressIndirection.CustomerId,
                Address    = AddressIndirection.Address
            });

            await _db.SaveChangesAsync();

            return(new Models.AddressIndirection {
                Id = a.Entity.Id,
                Address = a.Entity.Address,
                CustomerId = a.Entity.CustomerId,
                Customer = new Models.Customer()
            });
        }
Beispiel #2
0
        public async Task <Models.AddressIndirection> PatchAsync(System.Guid AddressIndirectionId, Models.AddressIndirection AddressIndirection)
        {
            var a = await _db.FindAsync <Models.AddressIndirection>(AddressIndirectionId);

            if (a == null)
            {
                throw new KeyNotFoundException();
            }
            a.Address = AddressIndirection.Address ?? a.Address;
            await _db.SaveChangesAsync();

            return(a);
        }