public async Task <IActionResult> CreateContact([FromBody] Contact contact)
        {
            try
            {
                await _repo.CreateContact(contact);
            }
            catch
            {
            }

            return(Ok());
        }
Exemplo n.º 2
0
        public IActionResult PostContact([FromBody] Contact contact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var contactDto = _contactRepo.CreateContact(contact);

            if (contactDto == null)
            {
                return(BadRequest());
            }

            return(CreatedAtAction("GetContact", new { id = contact.Id }, contactDto));
        }
        public async Task <IActionResult> CreateContact([FromBody] Contact contact)
        {
            await _repo.CreateContact(contact);

            return(Ok(StatusCodes.Status201Created));
        }