Ejemplo n.º 1
0
        public async Task <Models.PhoneNumberIndirection> PostAsync(Models.PhoneNumberIndirection PhoneNumberIndirection)
        {
            var a = await _db.AddAsync(new Models.PhoneNumberIndirection {
                CustomerId  = PhoneNumberIndirection.CustomerId,
                PhoneNumber = PhoneNumberIndirection.PhoneNumber
            });

            await _db.SaveChangesAsync();

            return(new Models.PhoneNumberIndirection {
                Id = a.Entity.Id,
                CustomerId = a.Entity.CustomerId,
                PhoneNumber = a.Entity.PhoneNumber,
                Customer = new Models.Customer()
            });
        }
Ejemplo n.º 2
0
        public async Task <Models.PhoneNumberIndirection> PatchAsync(System.Guid PhoneNumberIndirectionId, Models.PhoneNumberIndirection PhoneNumberIndirection)
        {
            var a = await _db.FindAsync <Models.PhoneNumberIndirection>(PhoneNumberIndirectionId);

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

            return(a);
        }