Exemple #1
0
        public async Task <IActionResult> CreateAddressType([FromBody] Person.AddressType value)
        {
            _db.Person_AddressType.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
Exemple #2
0
        public async Task <IActionResult> EditAddressType(int addressTypeID, [FromBody] Person.AddressType value)
        {
            var existing = await _db.Person_AddressType.FirstOrDefaultAsync(x => x.AddressTypeID == addressTypeID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.AddressTypeID = value.AddressTypeID;
            existing.Name          = value.Name;
            existing.rowguid       = value.rowguid;
            existing.ModifiedDate  = value.ModifiedDate;

            _db.Person_AddressType.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }