public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequestMessage req, TraceWriter log) { var employeesDataProvider = InjectionFactory.GetIEmployeeDataProvider(); var httpResponseCreator = InjectionFactory.GetIHttpResponseCreator(); var employees = await employeesDataProvider.GetEmployees(); return(httpResponseCreator.CreateHttpResponse(req, HttpStatusCode.OK, employees)); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestMessage req, TraceWriter log) { var employeeDataProvider = InjectionFactory.GetIEmployeeDataProvider(); var httpResponseCreator = InjectionFactory.GetIHttpResponseCreator(); var newEmployee = await req.Content.ReadAsAsync <Employee>(); await employeeDataProvider.AddEmployee(newEmployee); return(httpResponseCreator.CreateHttpResponse(req, HttpStatusCode.OK, newEmployee)); }