示例#1
0
        public async Task <IActionResult> CreateContactType([FromBody] Person.ContactType value)
        {
            _db.Person_ContactType.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
示例#2
0
        public async Task <IActionResult> EditContactType(int contactTypeID, [FromBody] Person.ContactType value)
        {
            var existing = await _db.Person_ContactType.FirstOrDefaultAsync(x => x.ContactTypeID == contactTypeID);

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

            existing.ContactTypeID = value.ContactTypeID;
            existing.Name          = value.Name;
            existing.ModifiedDate  = value.ModifiedDate;

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

            return(NoContent());
        }