コード例 #1
0
ファイル: AddressController.cs プロジェクト: branc116/kontakt
        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()
            });
        }
コード例 #2
0
ファイル: AddressController.cs プロジェクト: branc116/kontakt
        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);
        }