Пример #1
0
        public async Task <IActionResult> PutContactType(int id, PublicApi.v2.DTO.ContactType contactType)
        {
            if (id != contactType.Id)
            {
                return(BadRequest());
            }

            _bll.ContactTypes.Update(PublicApi.v2.Mappers.ContactTypeMapper.MapFromExternal(contactType));
            await _bll.SaveChangesAsync();

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <PublicApi.v2.DTO.ContactType> > PostContactType(PublicApi.v2.DTO.ContactType contactType)
        {
            await _bll.ContactTypes.AddAsync(PublicApi.v2.Mappers.ContactTypeMapper.MapFromExternal(contactType));

            await _bll.SaveChangesAsync();

            return(CreatedAtAction("GetContactType", new { id = contactType.Id }, contactType));
        }