public async Task <IActionResult> ExpandScheduleAsync([FromRoute] int id, [FromBody] int days) { try { var acc = await _accommodationService.GetAccommodationAsync(id); if (!CorrectUserOrAdmin(acc.Owner.Id, GetIdOfLoggedInUser(HttpContext), GetUsertypeOfLoggedInUser(HttpContext))) { return(BadRequest("Restricted acces, this action can only be done by administrator or owner of the accommodation!")); } await _accommodationService.ExpandScheduleOfAccommodationWithXAmountOfDaysAsync(id, days); return(NoContent()); } catch (Exception ex) { if (ex.GetType().IsAssignableFrom(typeof(NotFoundException))) { return(NotFound(ex.Message)); } else { return(BadRequest(ex.Message)); } } }