public IActionResult AddPriceHistoryEntry(string name, [FromBody] PriceHistoryEntry newEntry) { // Check if a date is provided, otherwise use the current time. newEntry.Date = newEntry.Date == DateTime.MinValue ? TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "Europe/Amsterdam") : newEntry.Date; try { locationService.AddHistoryEntry(name, newEntry); return(NoContent()); } catch (Exception e) { return(BadRequest(e)); } }