public async Task <HttpResponseMessage> GetTutorants([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "profile/tutorant")] HttpRequestMessage request, ILogger log) { tutorantService = new TutorantService(log); if (request.Method == HttpMethod.Get) { return(await tutorantService.GetAllTutorantProfiles()); } else if (request.Method == HttpMethod.Post) { JObject newTutorantProfile = null; /* Read from the request body */ using (StringReader reader = new StringReader(await request.Content.ReadAsStringAsync())) { newTutorantProfile = JsonConvert.DeserializeObject <JObject>(reader.ReadToEnd()); } return(await tutorantService.CreateTutorantProfile(newTutorantProfile)); } else { throw new NotImplementedException(); } }
public async Task <HttpResponseMessage> GetTutorantProfile([HttpTrigger(AuthorizationLevel.Anonymous, "get", "delete", Route = "profile/tutorant/{tutorantID}")] HttpRequestMessage request, int tutorantID, ILogger log) { tutorantService = new TutorantService(log); if (request.Method == HttpMethod.Get) { return(await tutorantService.GetTutorantProfileByID(tutorantID)); } else if (request.Method == HttpMethod.Delete) { return(await tutorantService.DeleteTutorantProfileByID(tutorantID)); } else { throw new NotImplementedException(); } }
public TutorantController(ITutorantService tutorantService) { this.tutorantService = tutorantService; }