public IActionResult GetContact(int contactId, string fields, [FromHeader(Name = "Accept")] string mediaType) { if (!MediaTypeHeaderValue.TryParse(mediaType, out MediaTypeHeaderValue parsedMediaType)) { return(BadRequest()); } if (!_propertyCheckerService.TypeHasProperties <Contact> (fields)) { return(BadRequest()); } var ContactFromRepo = _contactRepo.GetContact(contactId); if (ContactFromRepo == null) { return(NotFound()); } return(Ok(ContactFromRepo.ShapeData(fields))); }
public async Task <IHttpActionResult> GetContacts() { var contacts = await _contactInfo.GetContact(); return(Ok(contacts)); }