public async Task <HttpResponseMessage> CoachProfiles([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "profile/coach")] HttpRequestMessage request, ILogger log) { coachService = new CoachService(log); if (request.Method == HttpMethod.Get) { return(await coachService.GetAllCoachProfiles()); } else if (request.Method == HttpMethod.Post) { JObject newCoachProfile = null; /* Read from the requestBody */ using (StringReader reader = new StringReader(await request.Content.ReadAsStringAsync())) { newCoachProfile = JsonConvert.DeserializeObject <JObject>(reader.ReadToEnd()); } return(await coachService.CreateCoachProfile(newCoachProfile)); } else { throw new NotImplementedException(); } }