public async Task <JsonResult> CreateConference(string branchId, ConferenceDTO confDetails) { if (!IsNumeric(branchId) || ((await _dbContext.FindAsync <Branch>(Int32.Parse(branchId)) == null))) { throw new ArgumentNullException($"Null or invalid parameter: {nameof(branchId)}"); } if (confDetails == null) { throw new ArgumentNullException(nameof(confDetails)); } if (!IsConfDatesValid(confDetails.StartTime, confDetails.EndTime)) { throw new ArgumentOutOfRangeException($"Null or invalid parameter: {nameof(confDetails.StartTime)}, {nameof(confDetails.EndTime)}"); } //TODO: Need model to handle conference details //TODO: Check that conference is NEW var newConference = Conference.BuildConference(confDetails, Int32.Parse(branchId)); _dbContext.Conferences.Add(newConference); _dbContext.SaveChanges(); await Task.Yield(); return(Json(newConference)); }