Ejemplo n.º 1
0
        public async Task <HttpResponseMessage> AddContactAsync([FromBody] Contact contact)
        {
            if (await UserExist(contact))
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
            if (contact == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }

            _contactDb.Contacts.Add(contact);
            await _contactDb.SaveChangesAsync();

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }