public async Task <IActionResult> Register( [HttpTrigger(AuthorizationLevel.Function, "post", Route = "register")] HttpRequest req ) { string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); JObject data = JsonConvert.DeserializeObject <JObject>(requestBody); try { //need to get Location is this weird way because GetLocation in LocationService didnt work properly AddressData homeAdress = new AddressData( (string)data["home"]["address"], ((string)data["home"]["postalCode"]).Replace(" ", ""), (string)data["home"]["place"] ); LatLng homePoint = await _locationsService.GetLatLongFromAddress( homeAdress.AsString(), getLocationsServiceApiKey() ); Deliverer deliverer = new Deliverer( (string)data["emailAddress"], (string)data["password"], (DateTime)data["dateOfBirth"], (double)data["fare"], new Location(homeAdress, homePoint), (string)data["phoneNumber"], (int)data["range"], (Vehicles)(int)data["vehicle"] ); if (_deliverersRepository.Create(deliverer)) { return(new OkObjectResult(deliverer)); } else { return(new StatusCodeResult(500)); } } catch (Exception e) { _logger.Error(e.ToString()); return(new BadRequestResult()); } }