public async Task <ActionResult <List <ShiftDto> > > AddShifts(List <AddShiftDto> shiftDtos) { if (shiftDtos == null) { return(BadRequest(InvalidShiftError)); } var locationIds = shiftDtos.SelectDistinctToList(s => s.LocationId); if (locationIds.Count != 1) { return(BadRequest(CannotUpdateCrossLocationError)); } if (!PermissionDataFiltersExtensions.HasAccessToLocation(User, Db, locationIds.First())) { return(Forbid()); } var shift = await ShiftService.AddShifts(shiftDtos.Adapt <List <Shift> >()); return(Ok(shift.Adapt <List <ShiftDto> >())); }