public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestMessage req, ILogger log, [Inject] IApprenticeshipService apprenticeshipService) { Apprenticeship apprenticeship = await req.Content.ReadAsAsync <Apprenticeship>(); try { var updatedCourse = (Apprenticeship)await apprenticeshipService.Update(apprenticeship); return(new OkObjectResult(updatedCourse)); } catch (Exception e) { return(new InternalServerErrorObjectResult(e)); } }