public async Task <ActionResult> OccupyRoom(int projectId, int roomTypeId, int room, string reqId) { try { IReadOnlyCollection <int> ids = reqId.Split(',') .Select(s => int.TryParse(s, out var val) ? val : 0) .Where(val => val > 0) .ToList(); if (ids.Count > 0) { await _accommodationService.OccupyRoom(new OccupyRequest() { AccommodationRequestIds = ids, ProjectId = projectId, RoomId = room, }); return(Ok()); } } catch (Exception e) when(e is ArgumentException || e is JoinRpgEntityNotFoundException) { } catch { return(StatusCode(500)); } return(BadRequest()); }